JoltWatchBuilder<T> class
A widget that automatically rebuilds when a Readable value changes.
JoltWatchBuilder tracks a single Readable value and rebuilds the widget whenever that value changes. The widget uses FlutterEffect to manage reactive dependencies and trigger rebuilds.
Usage
The widget tracks the readable value during build. When the value changes, the widget automatically rebuilds with the new value passed to the builder.
Parameters
- readable: The Readable value to track
- builder: Function that builds a widget from the current value and context
Example
final counter = Signal(0);
JoltWatchBuilder<int>(
readable: counter,
builder: (context, value) => Text('Count: $value'),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- JoltWatchBuilder
Constructors
-
JoltWatchBuilder({Key? key, required Readable<
T> readable, required Widget builder(BuildContext context, T value)}) -
const
-
JoltWatchBuilder.value({required Readable<
T> readable, required Widget builder(T value)}) -
Factory constructor for creating a builder without context parameter.
factory
Properties
- builder → Widget Function(BuildContext context, T value)
-
Function that builds a widget from the current value.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
readable
→ Readable<
T> -
The Readable value to track for changes.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → JoltWatchBuilderElement -
Creates a StatelessElement to manage this widget's location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited