value property
Implementation
@override
T get value {
_context.enforceReadPolicy(this);
reportObserved();
return _value;
}
void
value=(T value)
Implementation
set value(T value) {
_context.enforceWritePolicy(this);
final oldValue = _value;
final newValueDynamic = _prepareNewValue(value);
if (newValueDynamic is WillChangeNotification &&
newValueDynamic == WillChangeNotification.unchanged) {
return;
}
final newValue = newValueDynamic as T;
final notifySpy = _context.isSpyEnabled;
if (notifySpy) {
_context.spyReport(ObservableValueSpyEvent(this,
newValue: newValue, oldValue: oldValue, name: name));
}
_value = newValue;
reportChanged();
if (_listeners.hasHandlers) {
final change = ChangeNotification<T>(
newValue: value,
oldValue: oldValue,
type: OperationType.update,
object: this);
_listeners.notifyListeners(change);
}
if (notifySpy) {
_context.spyReport(EndedSpyEvent(type: 'observable', name: name));
}
}