Skip to content

[H] Created a variant of InheritedWidget specifically for Listenables - #23393

Merged
Hixie merged 2 commits into
flutter:masterfrom
Hixie:inherited_notifier
Oct 27, 2018
Merged

Hixie merged 2 commits into
flutter:masterfrom
Hixie:inherited_notifier

Conversation

@Hixie

@Hixie Hixie commented Oct 23, 2018

Copy link
Copy Markdown
Contributor

@HansMuller HansMuller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is updated.

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ChangeNotified => ChangeNotifier

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor

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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Copy Markdown
Contributor

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 ==?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Hixie Hixie changed the title Created a variant of InheritedWidget specifically for Listenables [H] Created a variant of InheritedWidget specifically for Listenables Oct 25, 2018
@Hixie
Hixie force-pushed the inherited_notifier branch from a427837 to c864d7f Compare October 26, 2018 05:30
@Hixie

Hixie commented Oct 26, 2018

Copy link
Copy Markdown
Contributor Author

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.

@Hixie
Hixie force-pushed the inherited_notifier branch from c864d7f to 49a44f9 Compare October 27, 2018 07:16
@Hixie
Hixie force-pushed the inherited_notifier branch from 49a44f9 to a5b6d65 Compare October 27, 2018 22:38
@Hixie
Hixie merged commit 9313285 into flutter:master Oct 27, 2018
@Hixie
Hixie deleted the inherited_notifier branch October 27, 2018 23:51
Hixie added a commit that referenced this pull request Oct 28, 2018
Hixie added a commit that referenced this pull request Oct 28, 2018
* Revert "[H] Created a variant of InheritedWidget specifically for Listenables (#23393)"

This reverts commit 9313285.

* Revert "Fix a race condition in vmservice_test.dart (#23529)"

This reverts commit 5e7b0a3.
Xavjer pushed a commit to Xavjer/flutter that referenced this pull request Nov 1, 2018
…flutter#23393)

* Created a variant of InheritedWidget specifically for Listenables

* Add more documentation per review comments
Xavjer pushed a commit to Xavjer/flutter that referenced this pull request Nov 1, 2018
* 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.
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants