value property

T get value

The current value of the signal.

Accessing this getter registers the signal with the currently active Observer, if any, so that dependent reactive computations will update automatically when this value changes.

Implementation

T get value {
  Observer.current?.track(this);
  return _value;
}
set value (T newValue)

Updates the signal's value to newValue.

If the new value is different from the current value, all subscribed listeners are notified.

Implementation

set value(T newValue) {
  if (_value == newValue) return;
  _value = newValue;
  for (final l in _listeners) {
    l();
  }
}