DiContainer class

DiContainer is a data structure that keep all dependencies resolvers

Available Extensions

Constructors

DiContainer([DiContainer? _parent])

Properties

hashCode int
The hash code for this object.
no setterinherited
parent DiContainer?
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addDispose<T>(void disposeFunc(T)) → void
Defines dispose strategy for type T. (It calls for every resolved dependency of type T when container's dispose was invoked
bind<T>() ResolvingContext<T>
Adds dependency resolver of type T to the container. Note that value overwriting within same container is prohibited. If you need it, please use override method instead.
dispose() → void
Disposes all resolved dependencies by the container and clear all dependencies
has<T>() bool
Returns true if this container has dependency resolver for type [T}. If you want to check it for the whole containers tree, use hasInTree instead.
hasInTree<T>() bool
Returns true if the container or it's parents contains dependency resolver for type T. If you want to check it only for this container, use has instead.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
override<T>() ResolvingContext<T>
Overrides dependency resolver for type T in the container
resolve<T>() → T
Returns resolved dependency defined by type parameter T. Throws StateError if dependency can't be resolved. If you want to get null if dependency can't be resolved, use tryResolve instead
toString() String
A string representation of this object.
inherited
tryResolve<T>() → T?
Returns resolved dependency of type T or null if it can't be resolved.

Operators

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