A context in which hooks can be used.
It's strongly recommended to use HookContextMixin when implementing HookContext.
- Implemented types
- Implementers
- Available extensions
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- mounted → bool
-
Whether this HookContext is still valid.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addPostBuildCallback(
void callback()) → void -
Registers
callback
to be called after the current build. -
getUnsafe(
Type type, {bool? watch}) → dynamic -
Retrieves the value of the requested
type
and optionally watches for its change. Returned values are guaranteed to be of typetype
or valueNotFound when it isn't found. Ifwatch
is not set, implementation should perform an educated guess (e.g. based on whether it's called during a build). Exact meaning of "watching" depends on the implementation and may not be supported.inherited -
markNeedsBuild(
) → void - Requests that this HookContext should be rebuilt.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
use<
T> (Hook< T> hook) → T -
Registers
hook
in this HookContext and returns its value.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- current → HookContext?
-
The currently active HookContext.
no setter
Static Methods
-
wrap<
T> (HookContext context, T callback()) → T -
Runs
callback
withcontext
as the current HookContext.