DiServiceLocator class final
An explicit, opt-in Service Locator adapter around one attached container.
This class does not create global state and does not own or close the attached container. Applications that require a shared locator decide where to retain this object and remain responsible for the container lifecycle.
Constructors
Properties
- container → DiContainer
-
The currently attached container.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isAttached → bool
-
Whether this locator currently has an attached container.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
attach(
DiContainer container) → void -
Attaches
containerwithout taking lifecycle ownership. -
detach(
) → DiContainer - Detaches and returns the current container without closing it.
-
get<
T> ({DiKey< T> ? key}) → T -
Resolves
Tsynchronously from the current container hierarchy. -
getAsync<
T> ({DiKey< T> ? key}) → Future<T> -
Resolves
Tasynchronously from the current container hierarchy. -
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