get method

T get()

Gets the current value of the signal.

If the signal is dirty, updates it first. Automatically establishes a dependency relationship with the active subscriber if one exists.

Returns the current committed value.

Implementation

@pragma('vm:align-loops')
T get() {
  if ((flags & ReactiveFlags.dirty) != ReactiveFlags.none) {
    if (didUpdate()) {
      final subs = this.subs;
      if (subs != null) {
        shallowPropagate(subs);
      }
    }
  }
  final sub = activeSub;
  if (sub != null && shouldTrack(sub)) {
    link(this, sub, cycle);
  }
  return currentValue;
}