processComputedUpdate method

void processComputedUpdate(
  1. Computed computed,
  2. int flags
)

Updates the computed subscriber if necessary before its value is accessed.

If the subscriber is marked Dirty or PendingComputed, this function runs the provided updateComputed logic and triggers a shallowPropagate for any downstream subscribers if an actual update occurs.

computed - The computed subscriber to update. flags - The current flag set for this subscriber.

Implementation

void processComputedUpdate(Computed computed, int flags) {
  if ((flags & SubscriberFlags.dirty) != 0 ||
      (checkDirty((computed as Subscriber).deps)
          ? true
          : ((flags &= ~SubscriberFlags.pendingComputed) == 0))) {
    if (updateComputed(computed)) {
      final subs = computed.subs;
      if (subs != null) {
        shallowPropagate(subs);
      }
    }
  }
}