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 Locator
A function that allows obtaining other objects.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


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.
toString() String
A string representation of this object.
update(Locator watch) → void
A life-cycle that allows listening to updates on another object.


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