LocatorMixin mixin
A mixin that adds service location capability to an object.
This makes the object aware of things like Provider.of
or GetIt
, without
actually depending on those.
It also provides testing utilities to be able to mock dependencies.
In the context of Flutter + provider
, adding that mixin to an object
makes it impossible to shared one instance across multiple "providers".
This mix-in does not do anything by itself.
It is simply an interface for 3rd party libraries such as provider to implement
the logic.
See also:
- read, to read objects
- debugMockDependency, to mock dependencies returned by read
- update, a new life-cycle to synchronize this object with external objects.
- debugUpdate, a method to test update.
Properties
Methods
-
debugMockDependency<
Dependency> (Dependency value) → void - Overrides read to mock its behavior in development.
-
debugUpdate(
) → void - A test utility to test the behavior of your initState/update method.
-
initState(
) → void - A life-cycle that allows initializing the StateNotifier based on values coming from read.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
Locator watch) → void - A life-cycle that allows listening to updates on another object.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited