waitForStart method
Called at the start of Host.start(cancellationToken)
which
will wait until it's complete before continuing. This can be
used to delay startup until signaled by an external event.
Implementation
@override
Future<void> waitForStart(CancellationToken cancellationToken) async {
applicationLifetime
..applicationStarted.register(
(state) => (state as FlutterLifetime)._onApplicationStarted(),
this,
)
..applicationStopping.register(
(state) => (state as FlutterLifetime)._onApplicationStopping(),
this,
)
..applicationPaused.add(_onPaused)
..applicationResumed.add(_onResumed)
..applicationInactive.add(_onInactive)
..applicationDetached.add(_onDetached);
applicationLifetime.applicationStarted.register(
(_) {
WidgetsFlutterBinding.ensureInitialized();
Widget? widget;
for (var builder in _builders) {
widget ??= _application;
widget = builder(_services, widget);
}
runApp(widget!);
},
);
}