ComputedNode<T> constructor

ComputedNode<T>(
  1. T getter(), {
  2. bool equals(
    1. T current,
    2. T? previous
    )?,
  3. JoltDebugOption? debug,
})

Creates a computed node that evaluates getter lazily and caches results.

The getter callback runs while this node is the active subscriber. When provided, equals can suppress propagation by returning true for a newly computed value that should be treated as unchanged.

Implementation

ComputedNode(this.getter, {this.equals, JoltDebugOption? debug})
    : super(flags: ReactiveFlags.none) {
  assert(() {
    JoltDevTools.create(this, debug);
    return true;
  }());
}