ComputedNode<T> class
Low-level reactive node that derives a value from dependencies.
This is the graph node behind Computed. It caches the result of getter, tracks dependencies while recomputing, and supports custom equality through equals.
Prefer Computed in application code; use ComputedNode for custom derived nodes on the core graph.
Example:
final source = SignalNode<int>(1);
final doubled = ComputedNode<int>(() => source.get() * 2);
- Inheritance
-
- Object
- ReactiveNode
- ComputedNode
Constructors
- ComputedNode(T getter(), {bool equals(T current, T? previous)?, JoltDebugOption? debug})
-
Creates a computed node that evaluates
getterlazily and caches results.
Properties
- deps ↔ Link?
-
First dependency link in the chain.
getter/setter pairinherited
- depsTail ↔ Link?
-
Last dependency link in the chain.
getter/setter pairinherited
- equals → bool Function(T current, T? previous)?
-
Optional equality function used to suppress propagation.
final
- flags ↔ int
-
Reactive flags for this node.
getter/setter pairinherited
- getter → T Function()
-
Function that computes the value while this node is the active subscriber.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDisposed → bool
-
Whether dispose has been called on this node.
no setter
- 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
- value ↔ T?
-
The cached result of the last successful evaluation of getter.
getter/setter pair
Methods
-
dispose(
) → void - Disposes this node and removes it from the dependency graph.
-
get(
) → T - Returns the cached or recomputed value and links to the active subscriber.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notify(
) → void - Recomputes immediately and always schedules subscribers for update.
-
notifySoft(
) → void - Recomputes immediately and schedules subscribers only when the value changes.
-
peek(
) → T - Returns the current computed value without establishing a dependency.
-
toString(
) → String -
A string representation of this object.
inherited
-
unwatched(
) → void -
Called when this node loses its last subscriber.
override
-
update(
) → bool -
Recomputes getter and updates the cached value.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited