| Index: pkg/observe/lib/src/change_notifier.dart
|
| diff --git a/pkg/observe/lib/src/change_notifier.dart b/pkg/observe/lib/src/change_notifier.dart
|
| index 54653e9e99115313cbb133b61130bfa845539d16..7febee562809dcce54d0840be77a964226a4600b 100644
|
| --- a/pkg/observe/lib/src/change_notifier.dart
|
| +++ b/pkg/observe/lib/src/change_notifier.dart
|
| @@ -9,14 +9,12 @@ import 'dart:collection' show UnmodifiableListView;
|
| import 'package:observe/observe.dart';
|
| import 'package:observe/src/observable.dart' show notifyPropertyChangeHelper;
|
|
|
| -/**
|
| - * Mixin and base class for implementing an [Observable] object that performs
|
| - * its own change notifications, and does not need to be considered by
|
| - * [Observable.dirtyCheck].
|
| - *
|
| - * When a field, property, or indexable item is changed, a derived class should
|
| - * call [notifyPropertyChange]. See that method for an example.
|
| - */
|
| +/// Mixin and base class for implementing an [Observable] object that performs
|
| +/// its own change notifications, and does not need to be considered by
|
| +/// [Observable.dirtyCheck].
|
| +///
|
| +/// When a field, property, or indexable item is changed, a derived class should
|
| +/// call [notifyPropertyChange]. See that method for an example.
|
| abstract class ChangeNotifier implements Observable {
|
| StreamController _changes;
|
| List<ChangeRecord> _records;
|
| @@ -31,15 +29,11 @@ abstract class ChangeNotifier implements Observable {
|
|
|
| // TODO(jmesserly): should these be public? They're useful lifecycle methods
|
| // for subclasses. Ideally they'd be protected.
|
| - /**
|
| - * Override this method to be called when the [changes] are first observed.
|
| - */
|
| + /// Override this method to be called when the [changes] are first observed.
|
| void observed() {}
|
|
|
| - /**
|
| - * Override this method to be called when the [changes] are no longer being
|
| - * observed.
|
| - */
|
| + /// Override this method to be called when the [changes] are no longer being
|
| + /// observed.
|
| void unobserved() {
|
| // Free some memory
|
| _changes = null;
|
| @@ -55,27 +49,23 @@ abstract class ChangeNotifier implements Observable {
|
| return false;
|
| }
|
|
|
| - /**
|
| - * True if this object has any observers, and should call
|
| - * [notifyPropertyChange] for changes.
|
| - */
|
| + /// True if this object has any observers, and should call
|
| + /// [notifyPropertyChange] for changes.
|
| bool get hasObservers => _changes != null && _changes.hasListener;
|
|
|
| - /**
|
| - * 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]. This makes it easy to use in a
|
| - * setter:
|
| - *
|
| - * var _myField;
|
| - * @reflectable get myField => _myField;
|
| - * @reflectable set myField(value) {
|
| - * _myField = notifyPropertyChange(#myField, _myField, value);
|
| - * }
|
| - */
|
| + /// 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]. This makes it easy to use in a
|
| + /// setter:
|
| + ///
|
| + /// var _myField;
|
| + /// @reflectable get myField => _myField;
|
| + /// @reflectable set myField(value) {
|
| + /// _myField = notifyPropertyChange(#myField, _myField, value);
|
| + /// }
|
| notifyPropertyChange(Symbol field, Object oldValue, Object newValue)
|
| => notifyPropertyChangeHelper(this, field, oldValue, newValue);
|
|
|
|
|