DIBase class base
Base class for the dependency injection container
Constructors
Properties
-
childrenContainer
↔ Option<
DI> -
Container for child DI instances.
getter/setter pair
- focusGroup ↔ Entity
-
A key that identifies the current group in focus for dependency management.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
-
parents
→ Set<
DI> -
Parent containers.
final
- registry → DIRegistry
-
Internal registry that stores dependencies.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
call<
T extends Object> ({Entity groupEntity = const DefaultEntity(), bool traverse = true}) → T -
children(
) → Option< Iterable< DI> > - Retrieves an iterable of child DI instances.
-
get<
T extends Object> ({Entity groupEntity = const DefaultEntity(), bool traverse = true}) → Option< Resolvable< T> > - Retrieves a dependency from the container. Retrieves a dependency from the container.
-
getAsync<
T extends Object> ({Entity groupEntity = const DefaultEntity(), bool traverse = true}) → Option< Async< T> > -
getAsyncUnsafe<
T extends Object> ({Entity groupEntity = const DefaultEntity(), bool traverse = true}) → Future< T> - Retrieves an asynchronous dependency unsafely, returning a future of the instance or throwing an error if not found.
-
getDependency<
T extends Object> ({Entity groupEntity = const DefaultEntity(), bool traverse = true}) → Option< Result< Dependency< >T> > -
Retrieves the underlying
Dependency
object from the registry. -
getSync<
T extends Object> ({Entity groupEntity = const DefaultEntity(), bool traverse = true}) → Option< Sync< T> > - Retrieves a synchronous dependency.
-
getSyncOrNone<
T extends Object> ({Entity groupEntity = const DefaultEntity(), bool traverse = true}) → Option< T> -
Retrieves a synchronous dependency or
None
if not found or async. -
getSyncUnsafe<
T extends Object> ({Entity groupEntity = const DefaultEntity(), bool traverse = true}) → T - Retrieves a synchronous dependency.
-
getUnsafe<
T extends Object> ({Entity groupEntity = const DefaultEntity(), bool traverse = true}) → FutureOr< T> - Retrieves a dependency unsafely, returning the instance or a future of it, or throwing an error if not found.
-
isRegistered<
T extends Object> ({Entity groupEntity = const DefaultEntity(), bool traverse = true}) → bool - Retrieves a synchronous dependency unsafely, returning the instance directly or throwing an error if not found or async.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
register<
T extends Object> (FutureOr< T> value, {TOnRegisterCallback<T> ? onRegister, TOnUnregisterCallback<T> ? onUnregister, Entity groupEntity = const DefaultEntity(), bool enableUntilExactlyK = false}) → Resolvable<T> - Registers a dependency with the container.
-
registerDependency<
T extends Object> ({required Dependency< T> dependency, bool checkExisting = false}) → Result<Dependency< T> > -
Registers a
Dependency
object directly into the registry. -
removeDependency<
T extends Object> ({Entity groupEntity = const DefaultEntity()}) → Option< Dependency< Object> > - Removes a dependency from the internal registry.
-
resolveAll(
{Entity? groupEntity = const DefaultEntity()}) → Resolvable< Unit> -
Completes once all Async dependencies associated with
groupEntity
complete or any group ifgroupEntity
isnull
. -
toString(
) → String -
A string representation of this object.
inherited
-
unregister<
T extends Object> ({Entity groupEntity = const DefaultEntity(), bool traverse = true, bool removeAll = true, bool triggerOnUnregisterCallbacks = true}) → Resolvable< Option< T> > - Unregisters a dependency.
-
until<
TSuper extends Object, TSub extends TSuper> ({Entity groupEntity = const DefaultEntity(), bool traverse = true}) → Resolvable< TSub> -
Waits until a dependency of type
TSuper
or its subtypeTSub
is registered.TSuper
should typically be the most general type expected. -
untilSuper<
TSuper extends Object> ({Entity groupEntity = const DefaultEntity(), bool traverse = true}) → Resolvable< TSuper> -
Waits until a dependency of type
TSuper
is registered.TSuper
should typically be the most general type expected.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited