ServiceContextExtension 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 = .watch}) → T -
Available on BuildContext, provided by the ServiceContextExtension extension
Retrieves or lazily creates a service of typeT, and binds its lifecycle to this BuildContext's widget lifecycle. -
Available on BuildContext, provided by the ServiceContextExtension extension
Retrieves or lazily creates state shared bykeyacross elements under the same StateScope. -
stateOf<
T> (T create(), {Key? key, StateMode mode = .watch, dynamic onDispose(T)?}) → ValueState< T> -
Available on BuildContext, provided by the ServiceContextExtension extension
Retrieves or lazily creates a state of typeT, and binds its ValueState lifecycle to this BuildContext's widget lifecycle.