-
Notifications
You must be signed in to change notification settings - Fork 28.9k
update build doc string to advocate avoiding doing tasks other than b… #58213
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
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
/// This builder can get called arbitrarily and should not do anything beyond | ||
/// building a widget. |
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 just say:
This builder must only return a widget and should not have any side effects as it may be called multiple times.
@@ -686,6 +689,9 @@ class FutureBuilder<T> extends StatefulWidget { | |||
/// the value to which the future completed. If it completed with an error, | |||
/// [AsyncSnapshot.hasError] will be true and [AsyncSnapshot.error] will be | |||
/// set to the error object. | |||
/// | |||
/// This builder can get called arbitrarily and should not do anything beyond |
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.
same.
/// The framework calls this method when this widget is inserted into the tree | ||
/// in a given [BuildContext] and when the dependencies of this widget change | ||
/// (e.g., an [InheritedWidget] referenced by this widget changes). However, | ||
/// these are not the only place this method gets called. This method can be |
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.
Maybe say something around that it could potentially be called every frame and should not have any side effects.
@@ -1325,6 +1330,11 @@ abstract class State<T extends StatefulWidget> with Diagnosticable { | |||
/// * After calling [deactivate] and then reinserting the [State] object into | |||
/// the tree at another location. | |||
/// | |||
/// These are not the only place this method gets called. This method can be |
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.
Same here.
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 after comments are resolved.
/// method can potentially be called in every frames, and you should keep in | ||
/// mind that it should not have any side effects beyond building a widget. |
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.
per style guide: avoid empty phrases:
/// method can potentially be called in every frames, and you should keep in | |
/// mind that it should not have any side effects beyond building a widget. | |
/// method can potentially be called in every frames and should not have any | |
/// side effects beyond building a widget. |
@@ -1325,6 +1328,9 @@ abstract class State<T extends StatefulWidget> with Diagnosticable { | |||
/// * After calling [deactivate] and then reinserting the [State] object into | |||
/// the tree at another location. | |||
/// | |||
/// This method can potentially be called in every frames, and you should keep |
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.
same as above.
…uilding a widget
Description
title said it all
Related Issues
Fixes #16218
Tests
I added the following tests:
doc only change
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze --flutter-repo
) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.