updateComputed<T> method

bool updateComputed<T>(
  1. Computed<T> computed
)

Update the computed value and return true if changed

Implementation

@pragma('vm:prefer-inline')
@pragma('wasm:prefer-inline')
@pragma('dart2js:prefer-inline')
bool updateComputed<T>(Computed<T> computed) {
  ++cycle;
  computed.depsTail = null;
  computed.flags =
      5 /* ReactiveFlags.mutable | ReactiveFlags.recursedCheck */;
  final prevSub = setActiveSub(computed);

  try {
    final oldValue = computed.pendingValue;

    return (oldValue != (computed.pendingValue = computed.getter()));
  } finally {
    activeSub = prevSub;
    computed.flags &= ~4 /* ReactiveFlags.recursedCheck */;
    purgeDeps(computed);
  }
}