Short-circuit _debugCanPerformMutations if debugDoingLayout is false (#81246)
This commit is contained in:
parent
6beafa7b16
commit
d1f02ae075
@ -1359,11 +1359,18 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
||||
|
||||
/// Whether tree mutations are currently permitted.
|
||||
///
|
||||
/// Only valid when asserts are enabled. In release builds, always returns
|
||||
/// null.
|
||||
/// This is only useful during layout. One should also not mutate the tree at
|
||||
/// other times (e.g. during paint or while assembling the semantic tree) but
|
||||
/// this function does not currently enforce those conventions.
|
||||
///
|
||||
/// Only valid when asserts are enabled. This will throw in release builds.
|
||||
bool get _debugCanPerformMutations {
|
||||
late bool result;
|
||||
assert(() {
|
||||
if (owner != null && !owner!.debugDoingLayout) {
|
||||
result = true;
|
||||
return true;
|
||||
}
|
||||
RenderObject node = this;
|
||||
while (true) {
|
||||
if (node._doingThisLayoutWithCallback) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user