Unverified Commit a57aff05 authored by Yegor's avatar Yegor Committed by GitHub

fix build scope messages and docs (#18637)

parent c39f2f26
......@@ -1464,10 +1464,10 @@ abstract class RenderBox extends RenderObject {
return _size;
}
Size _size;
@protected
/// Setting the size, in checked mode, triggers some analysis of the render box,
/// as implemented by [debugAssertDoesMeetConstraints], including calling the intrinsic
/// sizing methods and checking that they meet certain invariants.
@protected
set size(Size value) {
assert(!(debugDoingThisResize && debugDoingThisLayout));
assert(sizedByParent || !debugDoingThisResize);
......
......@@ -1339,7 +1339,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
/// [markParentNeedsLayout], in the case where the parent needs to be laid out
/// as well as the child.
///
/// If [sizedByParent] has changed, called
/// If [sizedByParent] has changed, calls
/// [markNeedsLayoutForSizedByParentChange] instead of [markNeedsLayout].
void markNeedsLayout() {
assert(_debugCanPerformMutations);
......@@ -1636,7 +1636,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
/// children, passing true for parentUsesSize if your layout information is
/// dependent on your child's layout information. Passing true for
/// parentUsesSize ensures that this render object will undergo layout if the
/// child undergoes layout. Otherwise, the child can changes its layout
/// child undergoes layout. Otherwise, the child can change its layout
/// information without informing this render object.
@protected
void performLayout();
......
......@@ -2073,7 +2073,20 @@ class BuildOwner {
final List<Element> _dirtyElements = <Element>[];
bool _scheduledFlushDirtyElements = false;
bool _dirtyElementsNeedsResorting; // null means we're not in a buildScope
/// Whether [_dirtyElements] need to be sorted again as a result of more
/// elements becoming dirty during the build.
///
/// This is necessary to preserve the sort order defined by [Element._sort].
///
/// This field is set to null when [buildScope] is not actively rebuilding
/// the widget tree.
bool _dirtyElementsNeedsResorting;
/// Whether [buildScope] is actively rebuilding the widget tree.
///
/// [scheduleBuildFor] should only be called when this value is true.
bool get _debugIsInBuildScope => _dirtyElementsNeedsResorting != null;
/// The object in charge of the focus tree.
///
......@@ -2108,11 +2121,11 @@ class BuildOwner {
if (element._inDirtyList) {
assert(() {
if (debugPrintScheduleBuildForStacks)
debugPrintStack(label: 'markNeedsToResortDirtyElements() called; _dirtyElementsNeedsResorting was $_dirtyElementsNeedsResorting (now true); dirty list is: $_dirtyElements');
if (_dirtyElementsNeedsResorting == null) {
debugPrintStack(label: 'BuildOwner.scheduleBuildFor() called; _dirtyElementsNeedsResorting was $_dirtyElementsNeedsResorting (now true); dirty list is: $_dirtyElements');
if (!_debugIsInBuildScope) {
throw new FlutterError(
'markNeedsToResortDirtyElements() called inappropriately.\n'
'The markNeedsToResortDirtyElements() method should only be called while the '
'BuildOwner.scheduleBuildFor() called inappropriately.\n'
'The BuildOwner.scheduleBuildFor() method should only be called while the '
'buildScope() method is actively rebuilding the widget tree.'
);
}
......
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