Unverified Commit 8a19145f authored by chunhtai's avatar chunhtai Committed by GitHub

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

parent e934c2fc
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment