initialize function
Future<void>
initialize(
- Initializer userInitializer, {
- @Deprecated("Now you don't need to provide a method channel names to override them. " "They will be overridden by `combine` package.") MethodChannelSetup methodChannelSetup = const MethodChannelSetup(),
Initializes UIIsolateManager and IsolateManager in Isolate
and runs userInitializer
.
If already initialized kills previous Isolate
and creates new one.
Simply call this function at the start of main:
Future<void> main() async {
await initialize(initializerFunc);
runApp(...);
}
void initializerFunc() {
register<Bloc, State>(create: () => Bloc());
}
Implementation
Future<void> initialize(
Initializer userInitializer, {
@Deprecated(
"Now you don't need to provide a method channel names to override them. "
"They will be overridden by `combine` package.",
)
MethodChannelSetup methodChannelSetup = const MethodChannelSetup(),
}) async {
return IsolateInitializer().initialize(
userInitializer,
CombineIsolateFactory(),
);
}