ComputedNode<T> class

A reactive computed node that derives its value from other reactive nodes.

ComputedNode automatically tracks its dependencies and recalculates its value when any dependency changes. The computation is lazy - it only runs when the value is accessed and dependencies have changed.

Computed nodes cannot be directly written to; they always derive their value from the getter function.

Inheritance

Constructors

ComputedNode({required ReactiveFlags flags, required T getter(T?)})

Properties

currentValue ↔ T?
The cached computed value.
getter/setter pair
deps Link?
Head of the linked list of dependencies (nodes this node depends on). Null if this node has no dependencies.
getter/setter pairinherited
depsTail Link?
Tail of the linked list of dependencies for O(1) append operations. Points to the last dependency link.
getter/setter pairinherited
flags ReactiveFlags
Bit flags representing the current state of this node. See ReactiveFlags for possible values.
getter/setter pairinherited
getter → T Function(T?)
The function that computes this node's value.
final
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?
Head of the linked list of subscribers (nodes that depend on this node). Null if no other nodes depend on this one.
getter/setter pairinherited
subsTail Link?
Tail of the linked list of subscribers for O(1) append operations. Points to the last subscriber link.
getter/setter pairinherited

Methods

didUpdate() bool
Updates the computed value by re-running the getter.
get() → T
Gets the computed value, recalculating if necessary.
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