A type-keyed bag of values shared for one command run.
The type argument of fetch, maybeFetch, has, store, and remove
is the slot. store<Logger>(StdOutLogger()) is retrieved with
fetch<Logger>(), including when the value's runtime type is a subtype.
Constructors
-
ContextProvider([Map<
Type, Object> ? values]) -
factory
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
-
fetch<
T extends Object> () → T -
Returns the value stored under
T. -
has<
T extends Object> () → bool -
Whether a value of type
Tis stored. -
maybeFetch<
T extends Object> () → T? -
Returns the value stored under
T, or null when fetch would throw. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove<
T extends Object> () → void -
Removes the value stored under
T, if any. -
store<
T extends Object> (T value) → void -
Stores
valueunderT, replacing any previous value in that slot. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited