-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate Observable, add ChangeNotifier, setup travis #11
Conversation
- dev | ||
- stable | ||
|
||
script: ./tool/presubmit.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] add a trailing newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -1,3 +1,36 @@ | |||
## 0.17.0 | |||
|
|||
This is a larger change with a goal of no runtime changes for current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] IMO the Changelog should be more succinct and these details should stay in the commit message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only reason I made this verbose is because of the implications.
/// May use [notifyChange] to queue a change record; they are asynchronously | ||
/// delivered at the end of the VM turn. | ||
/// | ||
/// [ChangeNotifier] may be extended, mixed in, or used as a delegate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for documenting that the class is meant to be extended
return (_changes ??= new StreamController<List<C>>.broadcast( | ||
sync: true, | ||
onListen: observed, | ||
onCancel: unobserved, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[optional] If you omit the trailing comma line 31 might format nicer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acknowledged.
/// May override to be notified when [changes] is first observed. | ||
@override | ||
@protected | ||
@mustCallSuper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we mainly marking this because we assume that transitively some subclasses may need it? For future proofing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I'm making it more clear now.
} | ||
} | ||
|
||
// Will be removed when Observable removes `notifyPropertyChange`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we mark it as deprecated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@override | ||
/*=T*/ notifyPropertyChange/*<T>*/( | ||
Symbol field, | ||
/*=T*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see dartfmt forcing this on its own line - did you choose it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just ran dartfmt no manual formatting.
Remove stable branch, as `collection` dependency won't resolve on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LGTM |
Partial work toward #10.
0.17.0
This is a larger change with a goal of no runtime changes for current
customers, but in the future
Observable
will become a verylightweight interface, i.e.:
Observable
interfaceChangeNotifier
should be used as a base class for these methods:Observable.observed
Observable.unobserved
Observable.hasObservers
Observable.deliverChanges
Observable.notifyChange
PropertyChangeNotifier
should be used for these methods:Observable.notifyPropertyChange
Observable
usesChangeNotifier
implements Observable
shouldmove to implementing or extending
ChangeNotifier
. In afuture release
Observable
will reduce API surface down toan abstract
Stream<List<C>> get changes
.ChangeNotifier
andPropertyChangeNotifier
classesObservable
in a generic mannerObservable<C extends ChangeRecord>
C
,notifyPropertyChange
is illegal