Injector class
The main entry point for dependency injection.
An Injector manages a collection of Providers and is responsible for resolving dependencies and providing services.
It supports hierarchical injectors, allowing you to create child injectors that inherit and can override providers from their parent.
- Implemented types
Constructors
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
-
dispose(
) → Future< void> -
override
-
getService<
T> ([Object? tokenOrType]) → Future< T> -
Gets a service of type
T. -
getServiceOrNull<
T> ([Object? tokenOrType]) → Future< T?> -
Gets a service of type
T, or returnsnullif it cannot be resolved. -
invokeApplyWithDependencies<
T> (DependencyData dependencyData, Function invokableFunction) → Future< T> -
Resolves dependencies and then invokes
invokableFunctionwith those dependencies. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerFactories(
List< InjectableFactory> factories) → void - Registers a list of InjectableFactorys with the injector.
-
registerFactory(
InjectableFactory factory) → void - Registers a single InjectableFactory with the injector.
-
resolveDependencies(
DependencyData dependencies) → Future< Dependencies> -
Resolves all dependencies specified in
dependencies. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited