Dependencies class final
A manager for dependency injection scopes, allowing dependencies to be dynamically registered, accessed, and disposed of within a defined scope.
The Dependencies class supports scoped dependency management, enabling dynamic registration of factories and resource cleanup.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
) → Future< Dependencies> -
Builds and returns an instance of type
T
from the registered factories, initializing all types that implements IInitializable. -
call<
T> () → T -
dispose(
) → void - Disposes of all dependencies in the current scope.
-
get<
T> () → T -
Retrieves an instance of type
T
from the current scope. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerFactory<
T> (T factory(Dependencies scope)) → void -
Registers a new factory in the current scope for creating instances of
type
T
. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- currentScope → Dependencies
-
Retrieves the current active dependency scope.
no setter
Static Methods
-
popScope(
) → void - Removes the current dependency scope from the stack.
-
pushScope(
List< Dependency< factories) → DependenciesObject> > - Pushes a new dependency scope to the stack and initializes it with the provided factories.