CustomReactiveNode<T> class
abstract
Base class for custom reactive nodes with custom update logic.
This class allows you to create reactive nodes that have custom update behavior beyond the standard signal and computed patterns. When a CustomReactiveNode is updated via updateCustom, the system calls updateNode to determine if the node's value has actually changed.
Implementing CustomReactiveNode
Subclasses must implement updateNode to define how the node updates and whether its value has changed. The method should:
- Update the node's internal state if needed
- Return
trueif the value changed (subscribers will be notified) - Return
falseif the value did not change (no notifications)
Example:
class CustomWidgetPropsNode<T> extends CustomReactiveNode<T> {
CustomWidgetPropsNode() : super(flags: ReactiveFlags.mutable);
bool _dirty = false;
@override
void notify() {
_dirty = true;
notifyReactiveNode(this);
}
@override
bool updateNode() {
if (_dirty) {
_dirty = false;
return true; // Value changed, notify subscribers
}
return false; // No change
}
}
- Inheritance
-
- Object
- ReactiveNode
- CustomReactiveNode
- Implementers
Constructors
- CustomReactiveNode({required int flags})
Properties
- deps ↔ Link?
-
First dependency link in the chain.
getter/setter pairinherited
- depsTail ↔ Link?
-
Last dependency link in the chain.
getter/setter pairinherited
- flags ↔ int
-
Reactive flags for this node.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- subs ↔ Link?
-
First subscriber link in the chain.
getter/setter pairinherited
- subsTail ↔ Link?
-
Last subscriber link in the chain.
getter/setter pairinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
updateNode(
) → bool - Updates the node and reports whether its value changed.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited