value property

T get value

The current value of the atom.

Setting a new value will notify listeners if the new value is different from the current value (using equals or != operator).

Implementation

T get value => _value;
set value (T newValue)

Implementation

set value(T newValue) {
  if (_disposed) return;

  // Apply guard if present
  final guardedValue = guard != null ? guard!(_value, newValue) : newValue;

  // Check equality
  final areEqual =
      equals != null ? equals!(_value, guardedValue) : _value == guardedValue;

  if (!areEqual) {
    _previousValue = _value;
    _value = guardedValue;
    notifyListeners();
  }
}