update build doc string to advocate avoiding doing tasks other than b… (#58213)

This commit is contained in:
chunhtai
2020-06-04 10:18:02 -07:00
committed by GitHub
parent e934c2fc0a
commit 8a19145f3e
2 changed files with 16 additions and 4 deletions

View File

@@ -471,6 +471,9 @@ class StreamBuilder<T> extends StreamBuilderBase<T, AsyncSnapshot<T>> {
super(key: key, stream: stream);
/// The build strategy currently used by this builder.
///
/// This builder must only return a widget and should not have any side
/// effects as it may be called multiple times.
final AsyncWidgetBuilder<T> builder;
/// The data that will be used to create the initial snapshot.
@@ -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 must only return a widget and should not have any side
/// effects as it may be called multiple times.
final AsyncWidgetBuilder<T> builder;
/// The data that will be used to create the snapshots provided until a

View File

@@ -662,9 +662,11 @@ abstract class StatelessWidget extends Widget {
/// Describes the part of the user interface represented by this widget.
///
/// 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).
/// 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). This
/// method can potentially be called in every frames should not have any side
/// effects beyond building a widget.
///
/// The framework replaces the subtree below this widget with the widget
/// returned by this method, either by updating the existing subtree or by
@@ -1315,7 +1317,8 @@ abstract class State<T extends StatefulWidget> with Diagnosticable {
/// Describes the part of the user interface represented by this widget.
///
/// The framework calls this method in a number of different situations:
/// The framework calls this method in a number of different situations. For
/// example:
///
/// * After calling [initState].
/// * After calling [didUpdateWidget].
@@ -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 should not have
/// any side effects beyond building a widget.
///
/// The framework replaces the subtree below this widget with the widget
/// returned by this method, either by updating the existing subtree or by
/// removing the subtree and inflating a new subtree, depending on whether the