ServiceBuildContext extension
Provides convenience methods on BuildContext to retrieve, manage, and react to application-wide services and state.
- on
Methods
-
serviceOf<
T extends Service> (T create(), {Key? key, ServiceMode mode = ServiceMode.watch}) → T -
Available on BuildContext, provided by the ServiceBuildContext extension
Retrieves or lazily creates a service of typeT, and binds its lifecycle to this BuildContext's widget lifecycle. -
stateOf<
T> (T create(), {Key? key, StateMode mode = StateMode.watch, dynamic onDispose(T)?}) → ValueNotifier< T> -
Available on BuildContext, provided by the ServiceBuildContext extension
Retrieves or lazily creates a state of typeT, and binds its ValueNotifier lifecycle to this BuildContext's widget lifecycle.