FlutterHost class

Hosts services and provides dependency injection.

This class also controls the execution of the application itself, providing a framework for services to live in.

Use this code in your main function:

await FlutterHost(
  [
    () => ServiceA(),
    () => ServiceB(),
  ],
).run(const MyApp());

Note that this replaces the usual call to runApp(const MyApp()).

Constructors

FlutterHost(List<BaseService Function()> factories, {Map<String, dynamic> config = const <String, dynamic>{}})

Properties

failWithServices bool
finalinherited
hashCode int
The hash code for this object.
no setterinherited
isInShutdown bool
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
servicesReady → Notifier
finalinherited

Methods

getIsolatedHostConfiguration() → IsolatedHostConfiguration
inherited
initialize() Future<void>
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolveService<TService extends BaseService?>() → TService
inherited
run([Widget? app]) Future<void>
Runs the application.
runAsService<T>(T delegate()) → T
inherited
shutdown() Future<void>
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited