notifyPropertyChange<T> method

  1. @override
T notifyPropertyChange<T>(
  1. Symbol field,
  2. T oldValue,
  3. T newValue
)
inherited

Notify that the field name of this object has been changed.

The oldValue and newValue are also recorded. If the two values are equal, no change will be recorded.

For convenience this returns newValue.

Deprecated

All Observable objects will no longer be required to emit change records when any property changes. For example, ObservableList will only emit on ObservableList.changes, instead of on ObservableList.listChanges.

If you are using a typed implements/extends Observable<C>, it is illegal to call this method - will throw an UnsupportedError when called.

Implementation

@override
T notifyPropertyChange<T>(
  Symbol field,
  T oldValue,
  T newValue,
) {
  if (hasObservers && oldValue != newValue) {
    notifyChange(
      PropertyChangeRecord<T>(
        this,
        field,
        oldValue,
        newValue,
      ),
    );
  }
  return newValue;
}