HookBuilder class final

Shows what builder returns, which calls hooks: a HookWidget written in place.

A toggle that keeps its state in place, inside another widget's build:

HookBuilder(
  builder: (context) {
    final on = useState(false);
    return KeyBindings({
      'space': () => on.value = !on.value,
    }, child: Text(on.value ? '[x] Wrap' : '[ ] Wrap'));
  },
)
Inheritance

Constructors

HookBuilder({required WidgetBuilder builder, Key? key})
Shows what builder returns.
const

Properties

builder → WidgetBuilder
Builds what this widget shows, calling hooks; called by every build.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Tells this widget apart from its siblings; see Key.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

build(BuildContext context) → Widget
Describes this part of the interface; called when the widget is placed in the tree, whenever its parent gives it a new widget, and when its element is marked dirty.
override
createElement() → StatelessElement
Inflates this widget into a new element for the tree.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Adds what describes this widget in its element's description (Element.describe) to properties, those not worth showing (a default) left out; an override calls this first. A render object widget adds only what its render object does not show. Only Element.describe calls it: a frame never does.
inherited
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