HookState<R, T extends Hook<R>> class abstract

What the element of a build that uses a Hook keeps for it between builds, and the value use gives the build (build).

The first use calls initHook, then build; each later build calls didUpdateHook with the hook of the build before, unless the build gave the very same hook, then build. deactivate and activate are called with the element's, dispose when the element is unmounted or when the hook's Hook.keys change.

Constructors

HookState()

Properties

context → BuildContext
The element of the widget whose build uses the hook, from the first use until dispose returns.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hook → T
The hook of the current build; already the new one in didUpdateHook.
no setter
mounted → bool
Whether the state has an element: false once dispose has run.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

activate() → void
Called when a GlobalKey put the element back in the tree elsewhere.
build(BuildContext context) → R
The value use gives the build, asked for on every build.
deactivate() → void
Called when the element is removed from the tree; activate follows if a GlobalKey puts it back elsewhere in the same frame, dispose if not.
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Adds what describes this state to its element's description (Element.describe), after its widget's.
didUpdateHook(covariant T oldHook) → void
Called when a build used a new hook in the place of oldHook, keys equal; hook is already the new one.
dispose() → void
Called once, when the element is unmounted, or before a state is created in its place for a hook whose keys changed: release what the state holds.
initHook() → void
Called once, at the first use of the hook, before build; inherited widgets are depended on in build, which every build calls. When it throws, the state is not kept, nor disposed: the next build creates another.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setState(void fn()) → void
Runs fn, which changes this state, and rebuilds the element in the owner's next build scope.
toString() → String
A string representation of this object.
override

Operators

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