notifySoft method

void notifySoft()

Recomputes immediately and schedules subscribers only when the value changes.

When not inside a batch, queued effects flush before this call returns.

Example:

final node = ComputedNode<int>(() => 1);
node.notifySoft();

Implementation

void notifySoft() {
  if (!isDisposed) {
    assert(() {
      JoltDevTools.notify(this);
      return true;
    }());
    final updated = update();

    if (!updated) return;

    var subs = this.subs;

    while (subs != null) {
      subs.sub.flags |= ReactiveFlags.pending;
      shallowPropagate(subs);
      subs = subs.nextSub;
    }

    if (this.subs != null && batchDepth == 0) {
      flushEffects();
    }
  }
}