Dependency<T> class
Represents a registered dependency within the Weaver container.
A Dependency can either hold a direct value, a lazy instantiation callback, or act as a placeholder for a dependency that will be registered in the future. It uses a Completer to allow asynchronous waiting for the dependency to become available.
Constructors
- Dependency.lazy(T callback())
-
Creates a lazy Dependency that will be instantiated when first accessed.
factory
- Dependency.placeHolder()
-
Creates a placeholder Dependency that can be awaited before the actual
value is registered.
factory
- Dependency.value(T value)
-
Creates a Dependency with a pre-existing value.
factory
Properties
-
completer
→ Completer<
T> -
A Completer that completes when the dependency value is set.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasValue → bool
-
Returns true if the dependency has a value or a lazy instantiation callback.
no setter
- lazyInstantiateCallback ↔ T Function()?
-
The callback used for lazy instantiation of the dependency.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value ↔ T?
-
The current value of the dependency, if available.
getter/setter pair
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited