call method

  1. @override
T call()
override

Returns the current value of the signal.

Implementation

@override
T call() {
  final flags = this.flags;
  if ((flags & 16 /* Dirty */) != 0 ||
      ((flags & 32 /* Pending */) != 0 &&
          (checkDirty(deps!, this) ||
              // Always false, infinity is a value that can never be reached
              (this.flags = flags & -33 /* ~Pending */) ==
                  double.infinity))) {
    if (shouldUpdated()) {
      final subs = this.subs;
      if (subs != null) {
        shallowPropagate(subs);
      }
    }
  } else if (flags == 0 /* None */) {
    this.flags = 1 /* Mutable */;
    final prevSub = setActiveSub(this);
    try {
      cachedValue = getter(null);
    } finally {
      activeSub = prevSub;
    }
  }

  final sub = activeSub;
  if (sub != null) {
    link(this, sub, cycle);
  }

  return cachedValue as T;
}