execute method

  1. @override
Future<void> execute({
  1. void onSubProgress(
    1. double subFraction
    )?,
})
override

Performs the startup work for this task.

Called by StartupOrchestrator exactly once per startup. Must complete without error for the orchestrator to proceed to the next task.

The optional onSubProgress callback lets a task report intra-task progress as a fraction in the range [0.0, 1.0]. The orchestrator maps this to a global progress fraction and forwards it to StartupCubit so the splash screen can animate continuously during long-running tasks. Tasks that do not have meaningful sub-steps can ignore this parameter.

Implementation

@override
Future<void> execute({void Function(double subFraction)? onSubProgress}) async {
  _logger.info('[AppVersionCheckTask] Checking app version');

  final ForceUpdateException? forceUpdate = await AppVersionCheckTask.resolveForceUpdate(_remoteConfigService);

  if (forceUpdate == null) {
    _logger.info('[AppVersionCheckTask] Version check passed or no minimum version configured');
    Sentry.metrics.count('app.version.check.passed', 1);
    return;
  }

  _logger.info('[AppVersionCheckTask] Installed: ${forceUpdate.currentVersion}, required minimum: ${forceUpdate.minimumVersion}');
  Sentry.metrics.count('app.version.update_required', 1);
  throw forceUpdate;
}