Hook<T> class

Hook<T> gives the developer, the power of hooks to be used in their application.

The hook will attach itself to the Hookable widget and updates the widget whenever there is a change in value. The following is the implementation of a basic hook inside a Hookable widget.

...
late final Hook<int> count;
MyWidget() {
  count = Hook(0, this);
}
...

You must implement the hooks function inside the Hookable widget to use hooks.

Constructors

Hook(T value, Hookable hookableWidget)
The private constructor of Hook<T>

Properties

hashCode int
The hash code for this object.
no setterinherited
hookableWidget Hookable
The Widget that should be rebuilt when the value changes.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value ↔ T
The getter that provides the current value of variable
getter/setter pair

Methods

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