Scope class
Creates a Scope providing dependency injection to your call stack.
Scopes may be nested with the nearest Scope overriding parent scopes.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
factory<
T> (ScopeKey< T> key, T factory()) → void - Use single.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run<
R> (R action()) → R -
Runs
action
within the defined Scope. -
sequence<
T> (ScopeKey< T> key, T factory()) → void - Injects a generated value into the Scope.
-
single<
T> (ScopeKey< T> key, T factory()) → void - Injects a single value into the Scope.
-
toString(
) → String -
A string representation of this object.
override
-
value<
T> (ScopeKey< T> key, T value) → void - Injects value into the Scope.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
hasScopeKey<
T> (ScopeKey< T> key) → bool -
Returns true if
key
is contained within the current Scope or an ancestor Scope -
hasScopeValue<
T> (ScopeKey< T> key) → bool -
Returns true if
key
is contained within the current scope or an ancestor Scope or if thekey
has a default value. -
isWithinScope(
) → bool - Returns true if the caller is running within a Scope
-
use<
T> (ScopeKey< T> key, {T withDefault()?}) → T -
Returns the value provided for
key
, or the keys default value if no value was provided.