initialize method
Finish initialization by calling Initializer and sends initial states to the UIIsolateManager.
Throws InitializerException when some exception is thrown in Initializer in debug mode.
Implementation
Future<void> initialize(Initializer userInitializer) async {
_serviceEventsSubscription = _messenger.messagesStream
.where((event) => event is IsolateBlocEvent)
.cast<IsolateBlocEvent>()
.listen(_listenForMessagesFormUi);
try {
await userInitializer();
} catch (e, stackTrace) {
// Throw exception only in debug mode.
if (kDebugMode) {
throw InitializerException(e, stackTrace);
}
}
_initializeCompleter.complete();
_messenger.send(IsolateBlocsInitialized(_initialStates));
}