execute method
- void onSubProgress(
- 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('[ConnectivityInitTask] Initializing connectivity');
await _internetCubit.initialize();
final InternetState state = _internetCubit.state;
if (state is InternetConnected) {
_logger.info(
'[ConnectivityInitTask] Connectivity initialized — '
'${state.connectionType?.name ?? "unknown"} '
'(${state.internetStatus?.name ?? "unknown"})',
);
} else if (state is InternetDisconnected) {
_logger.warn(
'[ConnectivityInitTask] Connectivity initialized but device is offline — '
'app will continue with cached data where available',
);
} else {
_logger.warn('[ConnectivityInitTask] Connectivity initialized in unexpected state: $state');
}
}