-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[H] Created a variant of InheritedWidget specifically for Listenables #23393
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
Conversation
266755a to
a427837
Compare
HansMuller
left a comment
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
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.
Now it calls updated which calls notifyClients by default.
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.
This is updated.
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 suppose updateShouldNotify is now a bit of a misnomer, since notifyClients is only called by default. I'm not suggesting that the method should be called updateShouldCallUpdated though.
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 think from the perspective of people using the API, it's still conceptually more useful to think of it as a method that says whether to send the notifications.
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.
Doing this test in updated is subtly different (since calls to notifyClients used to be gated by updateShouldNotify) Hopefully no one will notice.
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.
Yeah, I wrestled with this quite a bit. I hope this is a subtle enough change to be fine.
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.
ChangeNotified => ChangeNotifier
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.
fixed
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.
This is a little confusing because Listenable isn't (necessarily) a Notifier and the developer might be wondering what "sends notifications" means.
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'll update the docs for Listenable to make the terminology clearer.
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.
Needs an assert(child != null)
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
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.
Does this need to document the fact that we're comparing the notifiers with ==?
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
a427837 to
c864d7f
Compare
|
Updated, PTAL if you're interested (the updates are in a new commit for ease of review). Will land on green unless I hear otherwise. |
c864d7f to
49a44f9
Compare
49a44f9 to
a5b6d65
Compare
…flutter#23393) * Created a variant of InheritedWidget specifically for Listenables * Add more documentation per review comments
* Revert "[H] Created a variant of InheritedWidget specifically for Listenables (flutter#23393)" This reverts commit 9313285. * Revert "Fix a race condition in vmservice_test.dart (flutter#23529)" This reverts commit 5e7b0a3.
cc @HansMuller