value property
The current value stored in this notifier.
When the value is replaced with something that is not equal to the old value as evaluated by the equality operator ==, this class notifies its listeners.
Throws a StateError, when trying to read this value and
isEmpty is true
.
Implementation
@override
T get value {
if (isEmpty)
throw StateError(
"Cannot access the value of this EmptyValueNotifier, "
"because isEmpty is true. "
"The value has to be set before accessing it, "
"if the constructor EmptyValueNotifier.empty was used.",
);
return _value!;
}
Implementation
@override
set value(T newValue) {
// Return if this notifier is not empty and the new
// value is equal to the current one.
if (isNotEmpty && _compare(_value, newValue)) return;
_isEmpty = false;
_value = newValue;
notifyListeners();
}