DIRegistry class final

Registry for storing and managing dependencies by runtime type and a group entity.

Constructors

DIRegistry.new({Option<TOnChangeRegistry> onChange = const None()})

Properties

groupEntities List<Entity>
A snapshot of the current group entities within state.
no setter
hashCode int
The hash code for this object.
no setterinherited
onChange Option<TOnChangeRegistry>
A callback invoked whenever the state is updated.
final
reversedDependencies List<Dependency<Object>>
Returns a list of all dependencies, sorted in reverse order of registration (newest first). Dependencies without a registration index are placed at the end.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state TRegistryState
A snapshot describing the current state of the dependencies.
no setter
unsortedDependencies Iterable<Dependency<Object>>
Returns an iterable of all dependencies in the registry, unsorted.
no setter

Methods

clear() → void
Clears the state, resetting the registry and effectively restoring it to the state of a newly created DIRegistry instance.
containsDependency<T extends Object>({Entity groupEntity = const DefaultEntity()}) bool
Checks if any dependency of type T or subtypes exists under the specified groupEntity
containsDependencyK(Entity typeEntity, {Entity groupEntity = const DefaultEntity()}) bool
Checks if any dependency registered under the exact typeEntity exists under the specified groupEntity. Unlike containsDependency, this will not include subtypes.
containsDependencyT(Type type, {Entity groupEntity = const DefaultEntity()}) bool
Checks if any dependency with the exact type exists under the specified groupEntity. Unlike containsDependency, this will not include subtypes of type.
dependenciesWhereType<T extends Object>() Iterable<Dependency<Object>>
Returns all dependencies witin this DIRegistry instance of type T.
dependenciesWhereTypeK(Entity typeEntity) Iterable<Dependency<Object>>
Returns all dependencies witin this DIRegistry instance of type typeEntity. Unlike dependenciesWhereType, this will not include subtypes.
dependenciesWhereTypeT(Type type) Iterable<Dependency<Object>>
Returns all dependencies witin this DIRegistry instance of type type. Unlike dependenciesWhereType, this will not include subtypes of type.
getDependencies<T extends Object>({Entity groupEntity = const DefaultEntity()}) Iterable<Dependency<T>>
Returns an iterable of all dependencies of type T within the specified groupEntity. This method considers exact type matches, not subtypes.
getDependency<T extends Object>({Entity groupEntity = const DefaultEntity()}) Option<Dependency<T>>
Returns any dependency of type T or subtypes under the specified groupEntity.
getDependencyK(Entity typeEntity, {Entity groupEntity = const DefaultEntity()}) Option<Dependency<Object>>
Returns any dependency with the exact typeEntity under the specified groupEntity. Unlike getDependency, this will not include subtypes.
getDependencyT(Type type, {Entity groupEntity = const DefaultEntity()}) Option<Dependency<Object>>
Returns any dependency with the exact type under the specified groupEntity. Unlike getDependency, this will not include subtypes.
getGroup({Entity groupEntity = const DefaultEntity()}) TDependencyGroup<Object>
Gets the TDependencyGroup with the specified groupEntity from the state or null if none exist.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removDependencyWhere(bool test(Entity entity, Dependency<Object> dependency), {Entity groupEntity = const DefaultEntity()}) → void
removeDependency<T extends Object>({Entity groupEntity = const DefaultEntity()}) Option<Dependency<T>>
Removes the first dependency of type T (or its subtypes) found under the specified groupEntity. If the group becomes empty after removal, the group itself is removed.
removeDependencyK(Entity typeEntity, {Entity groupEntity = const DefaultEntity()}) Option<Dependency<Object>>
Removes the dependency with the exact typeEntity under the specified groupEntity. If the group becomes empty after removal, the group itself is removed.
removeDependencyT(Type type, {Entity groupEntity = const DefaultEntity()}) Option<Dependency<Object>>
Removes the first dependency of type T (or its subtypes) found under the specified groupEntity. If the group becomes empty after removal, the group itself is removed.
removeGroup({Entity groupEntity = const DefaultEntity()}) → void
Removes the TDependencyGroup with the specified groupEntity from the state.
setDependency(Dependency<Object> dependency) → void
Updates the state by setting or updating dependency.
setGroup(TDependencyGroup<Object> group, {Entity groupEntity = const DefaultEntity()}) → void
Updates the state by setting or replacing the group under the specified groupEntity.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited