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);
}
}
}
ReactiveNode? sub = activeSub;
while (sub != null) {
// dart format off
if (
(sub.flags & 3 /*(ReactiveFlags.mutable | ReactiveFlags.watching)*/ ) !=
ReactiveFlags.none
) { // dart format on
link(this, sub, cycle);
break;
}
sub = sub.subs?.sub;
}
return currentValue;
}