Service<T> class
A simple utility class that encapsulates a Create
and a Dispose
function
and generates a Provider
in order to make the object created
with the Create
function available in the widget tree.
Just like Provider
s, the Create
function is called lazily by default.
If the Service needs to be initialized greedly, the lazy parameter
can be used:
AppGadget(
services: [
Service(create: (_) => MyCustomService(), lazy: false),
]
child: MyChildWidget()
);
A list of services can be specified when creating a new AppGadget widget:
AppGadget(
services: [
Service(create: (_) => MyCustomObject()),
Service(create: (_) => MyOtherCustomObject()),
]
child: MyChildWidget()
);
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited