DIBase class base
Base class for the dependency injection container. Holds the registry,
the parent links used by traverse, and the focusGroup that scopes
groupEntity-defaulted calls. The concrete DI class layers the public
Supports* mixins on top.
Constructors
- DIBase()
Properties
-
childrenContainer
↔ Option<
DI> -
Container for child DI instances. Production code should not mutate
this field directly —
registerChildis the supported entry point.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 -
Shorthand for getSyncUnsafe:
di<MyService>()returns the registeredMyServicesynchronously or throws if missing / async-only. -
children(
) → Option< Iterable< DI> > -
Returns already-materialised children only — an un-read
Lazy<DI>is skipped so iteratingchildren()from_maybeFinishcannot force-construct unrelated children. Snapshotted to survive re-entrant register/unregister. -
get<
T extends Object> ({Entity groupEntity = const DefaultEntity(), bool traverse = true}) → Option< Resolvable< T> > - Retrieves a dependency from the container.
-
getAsync<
T extends Object> ({Entity groupEntity = const DefaultEntity(), bool traverse = true}) → Option< Async< T> > -
Retrieves a dependency as
Async<T>regardless of whether it was registered synchronously or asynchronously, orNoneif not found. -
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, Set< DI> ? visited}) → Option<Result< Dependency< >T> > -
Retrieves the underlying
Dependencyobject from the registry. Iterative DFS — see isRegistered. -
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
Noneif not found or async. -
getSyncUnsafe<
T extends Object> ({Entity groupEntity = const DefaultEntity(), bool traverse = true}) → T -
Retrieves a synchronous dependency, returning the value directly. Throws
if the dependency is missing, async-only, or resolved to
Err. -
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, Set< DI> ? visited}) → bool -
Returns whether a dependency keyed under exact type
Tis registered ingroupEntity. Strict: aLazy<T>registration does NOT count here — callers wanting that must checkisRegistered<Lazy<T>>(). Mirrors the keying contract of the registry's insert/remove. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
register<
T extends Object> (FutureOr< T> value, {Option<TOnRegisterCallback< onRegister = const None(), Option<T> >TOnUnregisterCallback< onUnregister = const None(), Entity groupEntity = const DefaultEntity(), bool enableUntilExactlyK = false}) → Resolvable<T> >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(
{Option< Entity> groupEntity = const Some(DefaultEntity())}) → Resolvable<Unit> -
Completes once all Async dependencies associated with
groupEntitycomplete, or every group whengroupEntityis None. -
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
TSuperor its subtypeTSubis registered.TSupershould 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
TSuperis registered.TSupershould typically be the most general type expected.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited