<p dir="auto"><strong>Steps to recreate</strong></p>
<ol dir="auto">
<li>Run Android emulator with app open</li>
<li>In Android Studio open <code class="notranslate">Flutter Inspector</code></li>
<li>Click <code class="notranslate">Toggle Platform Mode</code> twice</li>
</ol>
<p dir="auto"><strong>Error message</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="I/flutter (15306): The following assertion was thrown building _CupertinoBackGestureDetector&lt;dynamic&gt;(state:
I/flutter (15306): _CupertinoBackGestureDetectorState&lt;dynamic&gt;#72c3a):
I/flutter (15306): 'package:flutter/src/rendering/object.dart': Failed assertion: line 1792 pos 12: '() {
I/flutter (15306):       final AbstractNode parent = this.parent;
I/flutter (15306):       if (parent is RenderObject)
I/flutter (15306):         return parent._needsCompositing;
I/flutter (15306):       return true;
I/flutter (15306):     }()': is not true."><pre class="notranslate"><code class="notranslate">I/flutter (15306): The following assertion was thrown building _CupertinoBackGestureDetector&lt;dynamic&gt;(state:
I/flutter (15306): _CupertinoBackGestureDetectorState&lt;dynamic&gt;#72c3a):
I/flutter (15306): 'package:flutter/src/rendering/object.dart': Failed assertion: line 1792 pos 12: '() {
I/flutter (15306):       final AbstractNode parent = this.parent;
I/flutter (15306):       if (parent is RenderObject)
I/flutter (15306):         return parent._needsCompositing;
I/flutter (15306):       return true;
I/flutter (15306):     }()': is not true.
</code></pre></div>
<p dir="auto"><strong>Stack trace snippet</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="I/flutter (15306): #2      RenderObject.markNeedsCompositingBitsUpdate (package:flutter/src/rendering/object.dart)
I/flutter (15306): #3      RenderObject.attach (package:flutter/src/rendering/object.dart:1232:7)
I/flutter (15306): #4      _RenderProxyBox&amp;RenderBox&amp;RenderObjectWithChildMixin.attach (package:flutter/src/rendering/object.dart:2631:11)
I/flutter (15306): #5      AbstractNode.adoptChild (package:flutter/src/foundation/node.dart:128:13)
I/flutter (15306): #6      RenderObject.adoptChild (package:flutter/src/rendering/object.dart:1077:11)
I/flutter (15306): #7      _RenderProxyBox&amp;RenderBox&amp;RenderObjectWithChildMixin.child= (package:flutter/src/rendering/object.dart:2626:7)
I/flutter (15306): #8      SingleChildRenderObjectElement.insertChildRenderObject (package:flutter/src/widgets/framework.dart:4669:18)
I/flutter (15306): #9      RenderObjectElement.attachRenderObject (package:flutter/src/widgets/framework.dart:4513:35)
I/flutter (15306): #10     Element._activateWithParent (package:flutter/src/widgets/framework.dart:2974:5)"><pre class="notranslate"><code class="notranslate">I/flutter (15306): #2      RenderObject.markNeedsCompositingBitsUpdate (package:flutter/src/rendering/object.dart)
I/flutter (15306): #3      RenderObject.attach (package:flutter/src/rendering/object.dart:1232:7)
I/flutter (15306): #4      _RenderProxyBox&amp;RenderBox&amp;RenderObjectWithChildMixin.attach (package:flutter/src/rendering/object.dart:2631:11)
I/flutter (15306): #5      AbstractNode.adoptChild (package:flutter/src/foundation/node.dart:128:13)
I/flutter (15306): #6      RenderObject.adoptChild (package:flutter/src/rendering/object.dart:1077:11)
I/flutter (15306): #7      _RenderProxyBox&amp;RenderBox&amp;RenderObjectWithChildMixin.child= (package:flutter/src/rendering/object.dart:2626:7)
I/flutter (15306): #8      SingleChildRenderObjectElement.insertChildRenderObject (package:flutter/src/widgets/framework.dart:4669:18)
I/flutter (15306): #9      RenderObjectElement.attachRenderObject (package:flutter/src/widgets/framework.dart:4513:35)
I/flutter (15306): #10     Element._activateWithParent (package:flutter/src/widgets/framework.dart:2974:5)
</code></pre></div>
<p dir="auto">I am able to trigger a reproducible assertion when adding (or removing) a <code class="notranslate">padding</code> argument to a <code class="notranslate">Container</code> and doing a hot-reload.  Note that the assertion happens only during a hot-reload, not during a hot-restart nor when doing the initial <code class="notranslate">flutter run</code>.</p>
<p dir="auto">I've tried to distill the reproduction case to be as small as possible.  Note that the use of a <code class="notranslate">GlobalKey</code>, a <code class="notranslate">GridView</code>, and the <code class="notranslate">BoxConstraints</code> all seem to be relevant.</p>
<h2 dir="auto">The failure</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ flutter run
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with &quot;--enable-software-rendering&quot;.
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...                                           0.7s
Resolving dependencies...                                        1.8s
Gradle task 'assembleDebug'...                                   3.8s
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...                      0.8s
Syncing files to device Android SDK built for x86...
D/        (16785): HostConnection::get() New Host Connection established 0xde8a9fc0, tid 16811
D/EGL_emulation(16785): eglMakeCurrent: 0xe1205ca0: ver 2 0 (tinfo 0xcd0cf9e0)
 2.5s

🔥  To hot reload changes while running, press &quot;r&quot;. To hot restart (and rebuild state), press &quot;R&quot;.
An Observatory debugger and profiler on Android SDK built for x86 is available at: http://127.0.0.1:46673/
For a more detailed help message, press &quot;h&quot;. To detach, press &quot;d&quot;; to quit, press &quot;q&quot;.

Initializing hot reload...                                      I/flutter (16785): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (16785): The following assertion was thrown building Container(constraints: BoxConstraints(0.0&lt;=w&lt;=Infinity,
I/flutter (16785): h=200.0)):
I/flutter (16785): 'package:flutter/src/rendering/object.dart': Failed assertion: line 1854 pos 12: '() {
I/flutter (16785):       final AbstractNode parent = this.parent;
I/flutter (16785):       if (parent is RenderObject)
I/flutter (16785):         return parent._needsCompositing;
I/flutter (16785):       return true;
I/flutter (16785):     }()': is not true.
I/flutter (16785):
I/flutter (16785): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (16785): more information in this error message to help you determine and fix the underlying cause.
I/flutter (16785): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (16785):   https://github.com/flutter/flutter/issues/new
I/flutter (16785):
I/flutter (16785): When the exception was thrown, this was the stack:
I/flutter (16785): #2      RenderObject.markNeedsCompositingBitsUpdate (package:flutter/src/rendering/object.dart:1854:12)
I/flutter (16785): #3      RenderObject.attach (package:flutter/src/rendering/object.dart:1294:7)
I/flutter (16785): #4      _RenderProxyBox&amp;RenderBox&amp;RenderObjectWithChildMixin.attach (package:flutter/src/rendering/object.dart:2720:11)
I/flutter (16785): #5      AbstractNode.adoptChild (package:flutter/src/foundation/node.dart:132:13)
I/flutter (16785): #6      RenderObject.adoptChild (package:flutter/src/rendering/object.dart:1139:11)
I/flutter (16785): #7      _RenderProxyBox&amp;RenderBox&amp;RenderObjectWithChildMixin.child= (package:flutter/src/rendering/object.dart:2715:7)
I/flutter (16785): #8      SingleChildRenderObjectElement.insertChildRenderObject (package:flutter/src/widgets/framework.dart:4815:18)
I/flutter (16785): #9      RenderObjectElement.attachRenderObject (package:flutter/src/widgets/framework.dart:4659:35)
I/flutter (16785): #10     Element.attachRenderObject.&lt;anonymous closure&gt; (package:flutter/src/widgets/framework.dart:2856:13)
I/flutter (16785): #11     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3716:14)
I/flutter (16785): #12     Element.attachRenderObject (package:flutter/src/widgets/framework.dart:2855:5)
I/flutter (16785): #13     Element.attachRenderObject.&lt;anonymous closure&gt; (package:flutter/src/widgets/framework.dart:2856:13)
I/flutter (16785): #14     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3716:14)
I/flutter (16785): #15     Element.attachRenderObject (package:flutter/src/widgets/framework.dart:2855:5)
I/flutter (16785): #16     Element.attachRenderObject.&lt;anonymous closure&gt; (package:flutter/src/widgets/framework.dart:2856:13)
I/flutter (16785): #17     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3716:14)
I/flutter (16785): #18     Element.attachRenderObject (package:flutter/src/widgets/framework.dart:2855:5)
I/flutter (16785): #19     Element.attachRenderObject.&lt;anonymous closure&gt; (package:flutter/src/widgets/framework.dart:2856:13)
I/flutter (16785): #20     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3716:14)
I/flutter (16785): #21     Element.attachRenderObject (package:flutter/src/widgets/framework.dart:2855:5)
I/flutter (16785): #22     Element.attachRenderObject.&lt;anonymous closure&gt; (package:flutter/src/widgets/framework.dart:2856:13)
I/flutter (16785): #23     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3716:14)
I/flutter (16785): #24     Element.attachRenderObject (package:flutter/src/widgets/framework.dart:2855:5)
I/flutter (16785): #25     Element._activateWithParent (package:flutter/src/widgets/framework.dart:3003:5)
I/flutter (16785): #26     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2928:18)
I/flutter (16785): #27     Element.updateChild (package:flutter/src/widgets/framework.dart:2739:12)
I/flutter (16785): #28     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4800:14)
I/flutter (16785): #29     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2936:14)
I/flutter (16785): #30     Element.updateChild (package:flutter/src/widgets/framework.dart:2739:12)
I/flutter (16785): #31     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #32     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #33     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3662:5)
I/flutter (16785): #34     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3657:5)
I/flutter (16785): #35     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2936:14)
I/flutter (16785): #36     Element.updateChild (package:flutter/src/widgets/framework.dart:2739:12)
I/flutter (16785): #37     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4800:14)
I/flutter (16785): #38     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2936:14)
I/flutter (16785): #39     Element.updateChild (package:flutter/src/widgets/framework.dart:2739:12)
I/flutter (16785): #40     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #41     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #42     StatelessElement.update (package:flutter/src/widgets/framework.dart:3742:5)
I/flutter (16785): #43     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #44     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #45     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #46     StatelessElement.update (package:flutter/src/widgets/framework.dart:3742:5)
I/flutter (16785): #47     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #48     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4807:14)
I/flutter (16785): #49     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #50     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #51     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #52     StatelessElement.update (package:flutter/src/widgets/framework.dart:3742:5)
I/flutter (16785): #53     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #54     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4807:14)
I/flutter (16785): #55     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #56     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4807:14)
I/flutter (16785): #57     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #58     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4807:14)
I/flutter (16785): #59     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #60     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4807:14)
I/flutter (16785): #61     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #62     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #63     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #64     StatefulElement.update (package:flutter/src/widgets/framework.dart:3839:5)
I/flutter (16785): #65     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #66     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #67     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #68     StatelessElement.update (package:flutter/src/widgets/framework.dart:3742:5)
I/flutter (16785): #69     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #70     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #71     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #72     StatefulElement.update (package:flutter/src/widgets/framework.dart:3839:5)
I/flutter (16785): #73     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #74     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4807:14)
I/flutter (16785): #75     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #76     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #77     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #78     ProxyElement.update (package:flutter/src/widgets/framework.dart:3951:5)
I/flutter (16785): #79     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #80     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4807:14)
I/flutter (16785): #81     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #82     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #83     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #84     StatefulElement.update (package:flutter/src/widgets/framework.dart:3839:5)
I/flutter (16785): #85     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #86     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #87     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #88     StatelessElement.update (package:flutter/src/widgets/framework.dart:3742:5)
I/flutter (16785): #89     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #90     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4807:14)
I/flutter (16785): #91     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #92     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #93     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #94     ProxyElement.update (package:flutter/src/widgets/framework.dart:3951:5)
I/flutter (16785): #95     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #96     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #97     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #98     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2272:33)
I/flutter (16785): #99     _WidgetsFlutterBinding&amp;BindingBase&amp;GestureBinding&amp;ServicesBinding&amp;SchedulerBinding&amp;PaintingBinding&amp;SemanticsBinding&amp;RendererBinding&amp;WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:673:20)
I/flutter (16785): #100    _WidgetsFlutterBinding&amp;BindingBase&amp;GestureBinding&amp;ServicesBinding&amp;SchedulerBinding&amp;PaintingBinding&amp;SemanticsBinding&amp;RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:219:5)
I/flutter (16785): #101    _WidgetsFlutterBinding&amp;BindingBase&amp;GestureBinding&amp;ServicesBinding&amp;SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
I/flutter (16785): #102    _WidgetsFlutterBinding&amp;BindingBase&amp;GestureBinding&amp;ServicesBinding&amp;SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
I/flutter (16785): #103    _WidgetsFlutterBinding&amp;BindingBase&amp;GestureBinding&amp;ServicesBinding&amp;SchedulerBinding.scheduleWarmUpFrame.&lt;anonymous closure&gt; (package:flutter/src/scheduler/binding.dart:751:7)
I/flutter (16785): #105    _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
I/flutter (16785): #106    _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
I/flutter (16785): #107    _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
I/flutter (16785): (elided 3 frames from class _AssertionError and package dart:async)
I/flutter (16785): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (16785): Another exception was thrown: 'package:flutter/src/foundation/node.dart': Failed assertion: line 106 pos 12: '_owner != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/foundation/node.dart': Failed assertion: line 106 pos 12: '_owner != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1153 pos 12: 'child.parentData != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/foundation/node.dart': Failed assertion: line 106 pos 12: '_owner != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/foundation/node.dart': Failed assertion: line 106 pos 12: '_owner != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1153 pos 12: 'child.parentData != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1153 pos 12: 'child.parentData != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/foundation/node.dart': Failed assertion: line 106 pos 12: '_owner != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/foundation/node.dart': Failed assertion: line 106 pos 12: '_owner != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1153 pos 12: 'child.parentData != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 3532 pos 14: 'owner._debugCurrentBuildTarget == this': is not true.

Reloaded 1 of 416 libraries in 674ms.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 3532 pos 14: 'owner._debugCurrentBuildTarget == this': is not true.
I/flutter (16785): Another exception was thrown: NoSuchMethodError: The method '_enableMutationsToDirtySubtrees' was called on null.
I/flutter (16785): Another exception was thrown: NoSuchMethodError: The setter 'offset=' was called on null.
I/flutter (16785): Another exception was thrown: RenderBox was not laid out: RenderPadding#3ac5e NEEDS-PAINT DETACHED
I/flutter (16785): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1493 pos 18: 'debugDoingThisResize || debugDoingThisLayout ||
I/chatty  (16785): uid=10080(com.example.visibilitydetectorsample) Thread-2 identical 2 lines
I/flutter (16785): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1493 pos 18: 'debugDoingThisResize || debugDoingThisLayout ||
I/flutter (16785): Another exception was thrown: NoSuchMethodError: The getter 'offset' was called on null.

Application finished."><pre class="notranslate"><code class="notranslate">$ flutter run
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...                                           0.7s
Resolving dependencies...                                        1.8s
Gradle task 'assembleDebug'...                                   3.8s
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...                      0.8s
Syncing files to device Android SDK built for x86...
D/        (16785): HostConnection::get() New Host Connection established 0xde8a9fc0, tid 16811
D/EGL_emulation(16785): eglMakeCurrent: 0xe1205ca0: ver 2 0 (tinfo 0xcd0cf9e0)
 2.5s

🔥  To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R".
An Observatory debugger and profiler on Android SDK built for x86 is available at: http://127.0.0.1:46673/
For a more detailed help message, press "h". To detach, press "d"; to quit, press "q".

Initializing hot reload...                                      I/flutter (16785): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (16785): The following assertion was thrown building Container(constraints: BoxConstraints(0.0&lt;=w&lt;=Infinity,
I/flutter (16785): h=200.0)):
I/flutter (16785): 'package:flutter/src/rendering/object.dart': Failed assertion: line 1854 pos 12: '() {
I/flutter (16785):       final AbstractNode parent = this.parent;
I/flutter (16785):       if (parent is RenderObject)
I/flutter (16785):         return parent._needsCompositing;
I/flutter (16785):       return true;
I/flutter (16785):     }()': is not true.
I/flutter (16785):
I/flutter (16785): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (16785): more information in this error message to help you determine and fix the underlying cause.
I/flutter (16785): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (16785):   https://github.com/flutter/flutter/issues/new
I/flutter (16785):
I/flutter (16785): When the exception was thrown, this was the stack:
I/flutter (16785): #2      RenderObject.markNeedsCompositingBitsUpdate (package:flutter/src/rendering/object.dart:1854:12)
I/flutter (16785): #3      RenderObject.attach (package:flutter/src/rendering/object.dart:1294:7)
I/flutter (16785): #4      _RenderProxyBox&amp;RenderBox&amp;RenderObjectWithChildMixin.attach (package:flutter/src/rendering/object.dart:2720:11)
I/flutter (16785): #5      AbstractNode.adoptChild (package:flutter/src/foundation/node.dart:132:13)
I/flutter (16785): #6      RenderObject.adoptChild (package:flutter/src/rendering/object.dart:1139:11)
I/flutter (16785): #7      _RenderProxyBox&amp;RenderBox&amp;RenderObjectWithChildMixin.child= (package:flutter/src/rendering/object.dart:2715:7)
I/flutter (16785): #8      SingleChildRenderObjectElement.insertChildRenderObject (package:flutter/src/widgets/framework.dart:4815:18)
I/flutter (16785): #9      RenderObjectElement.attachRenderObject (package:flutter/src/widgets/framework.dart:4659:35)
I/flutter (16785): #10     Element.attachRenderObject.&lt;anonymous closure&gt; (package:flutter/src/widgets/framework.dart:2856:13)
I/flutter (16785): #11     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3716:14)
I/flutter (16785): #12     Element.attachRenderObject (package:flutter/src/widgets/framework.dart:2855:5)
I/flutter (16785): #13     Element.attachRenderObject.&lt;anonymous closure&gt; (package:flutter/src/widgets/framework.dart:2856:13)
I/flutter (16785): #14     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3716:14)
I/flutter (16785): #15     Element.attachRenderObject (package:flutter/src/widgets/framework.dart:2855:5)
I/flutter (16785): #16     Element.attachRenderObject.&lt;anonymous closure&gt; (package:flutter/src/widgets/framework.dart:2856:13)
I/flutter (16785): #17     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3716:14)
I/flutter (16785): #18     Element.attachRenderObject (package:flutter/src/widgets/framework.dart:2855:5)
I/flutter (16785): #19     Element.attachRenderObject.&lt;anonymous closure&gt; (package:flutter/src/widgets/framework.dart:2856:13)
I/flutter (16785): #20     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3716:14)
I/flutter (16785): #21     Element.attachRenderObject (package:flutter/src/widgets/framework.dart:2855:5)
I/flutter (16785): #22     Element.attachRenderObject.&lt;anonymous closure&gt; (package:flutter/src/widgets/framework.dart:2856:13)
I/flutter (16785): #23     ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:3716:14)
I/flutter (16785): #24     Element.attachRenderObject (package:flutter/src/widgets/framework.dart:2855:5)
I/flutter (16785): #25     Element._activateWithParent (package:flutter/src/widgets/framework.dart:3003:5)
I/flutter (16785): #26     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2928:18)
I/flutter (16785): #27     Element.updateChild (package:flutter/src/widgets/framework.dart:2739:12)
I/flutter (16785): #28     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4800:14)
I/flutter (16785): #29     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2936:14)
I/flutter (16785): #30     Element.updateChild (package:flutter/src/widgets/framework.dart:2739:12)
I/flutter (16785): #31     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #32     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #33     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3662:5)
I/flutter (16785): #34     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3657:5)
I/flutter (16785): #35     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2936:14)
I/flutter (16785): #36     Element.updateChild (package:flutter/src/widgets/framework.dart:2739:12)
I/flutter (16785): #37     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4800:14)
I/flutter (16785): #38     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2936:14)
I/flutter (16785): #39     Element.updateChild (package:flutter/src/widgets/framework.dart:2739:12)
I/flutter (16785): #40     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #41     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #42     StatelessElement.update (package:flutter/src/widgets/framework.dart:3742:5)
I/flutter (16785): #43     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #44     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #45     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #46     StatelessElement.update (package:flutter/src/widgets/framework.dart:3742:5)
I/flutter (16785): #47     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #48     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4807:14)
I/flutter (16785): #49     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #50     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #51     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #52     StatelessElement.update (package:flutter/src/widgets/framework.dart:3742:5)
I/flutter (16785): #53     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #54     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4807:14)
I/flutter (16785): #55     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #56     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4807:14)
I/flutter (16785): #57     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #58     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4807:14)
I/flutter (16785): #59     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #60     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4807:14)
I/flutter (16785): #61     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #62     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #63     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #64     StatefulElement.update (package:flutter/src/widgets/framework.dart:3839:5)
I/flutter (16785): #65     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #66     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #67     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #68     StatelessElement.update (package:flutter/src/widgets/framework.dart:3742:5)
I/flutter (16785): #69     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #70     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #71     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #72     StatefulElement.update (package:flutter/src/widgets/framework.dart:3839:5)
I/flutter (16785): #73     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #74     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4807:14)
I/flutter (16785): #75     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #76     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #77     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #78     ProxyElement.update (package:flutter/src/widgets/framework.dart:3951:5)
I/flutter (16785): #79     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #80     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4807:14)
I/flutter (16785): #81     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #82     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #83     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #84     StatefulElement.update (package:flutter/src/widgets/framework.dart:3839:5)
I/flutter (16785): #85     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #86     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #87     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #88     StatelessElement.update (package:flutter/src/widgets/framework.dart:3742:5)
I/flutter (16785): #89     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #90     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4807:14)
I/flutter (16785): #91     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #92     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #93     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #94     ProxyElement.update (package:flutter/src/widgets/framework.dart:3951:5)
I/flutter (16785): #95     Element.updateChild (package:flutter/src/widgets/framework.dart:2728:15)
I/flutter (16785): #96     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3693:16)
I/flutter (16785): #97     Element.rebuild (package:flutter/src/widgets/framework.dart:3530:5)
I/flutter (16785): #98     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2272:33)
I/flutter (16785): #99     _WidgetsFlutterBinding&amp;BindingBase&amp;GestureBinding&amp;ServicesBinding&amp;SchedulerBinding&amp;PaintingBinding&amp;SemanticsBinding&amp;RendererBinding&amp;WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:673:20)
I/flutter (16785): #100    _WidgetsFlutterBinding&amp;BindingBase&amp;GestureBinding&amp;ServicesBinding&amp;SchedulerBinding&amp;PaintingBinding&amp;SemanticsBinding&amp;RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:219:5)
I/flutter (16785): #101    _WidgetsFlutterBinding&amp;BindingBase&amp;GestureBinding&amp;ServicesBinding&amp;SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
I/flutter (16785): #102    _WidgetsFlutterBinding&amp;BindingBase&amp;GestureBinding&amp;ServicesBinding&amp;SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
I/flutter (16785): #103    _WidgetsFlutterBinding&amp;BindingBase&amp;GestureBinding&amp;ServicesBinding&amp;SchedulerBinding.scheduleWarmUpFrame.&lt;anonymous closure&gt; (package:flutter/src/scheduler/binding.dart:751:7)
I/flutter (16785): #105    _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
I/flutter (16785): #106    _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
I/flutter (16785): #107    _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
I/flutter (16785): (elided 3 frames from class _AssertionError and package dart:async)
I/flutter (16785): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (16785): Another exception was thrown: 'package:flutter/src/foundation/node.dart': Failed assertion: line 106 pos 12: '_owner != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/foundation/node.dart': Failed assertion: line 106 pos 12: '_owner != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1153 pos 12: 'child.parentData != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/foundation/node.dart': Failed assertion: line 106 pos 12: '_owner != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/foundation/node.dart': Failed assertion: line 106 pos 12: '_owner != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1153 pos 12: 'child.parentData != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1153 pos 12: 'child.parentData != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/foundation/node.dart': Failed assertion: line 106 pos 12: '_owner != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/foundation/node.dart': Failed assertion: line 106 pos 12: '_owner != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1153 pos 12: 'child.parentData != null': is not true.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 3532 pos 14: 'owner._debugCurrentBuildTarget == this': is not true.

Reloaded 1 of 416 libraries in 674ms.
I/flutter (16785): Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 3532 pos 14: 'owner._debugCurrentBuildTarget == this': is not true.
I/flutter (16785): Another exception was thrown: NoSuchMethodError: The method '_enableMutationsToDirtySubtrees' was called on null.
I/flutter (16785): Another exception was thrown: NoSuchMethodError: The setter 'offset=' was called on null.
I/flutter (16785): Another exception was thrown: RenderBox was not laid out: RenderPadding#3ac5e NEEDS-PAINT DETACHED
I/flutter (16785): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1493 pos 18: 'debugDoingThisResize || debugDoingThisLayout ||
I/chatty  (16785): uid=10080(com.example.visibilitydetectorsample) Thread-2 identical 2 lines
I/flutter (16785): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1493 pos 18: 'debugDoingThisResize || debugDoingThisLayout ||
I/flutter (16785): Another exception was thrown: NoSuchMethodError: The getter 'offset' was called on null.

Application finished.
</code></pre></div>
<h2 dir="auto">The code</h2>
<div class="highlight highlight-source-dart notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import 'package:flutter/material.dart';

void main() {
  return runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  MyHomePage({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      // XXX: Removing (or adding) the following line and doing a hot-reload
      //      triggers a framework assertion.  Hot restart is fine.
      padding: const EdgeInsets.all(5),
      child: Container(
        constraints: const BoxConstraints(minHeight: 200, maxHeight: 200),
        child: GridView.count(
          key: _myKey,
          crossAxisCount: 2,
          children: &lt;Widget&gt;[Placeholder(), Placeholder()],
        ),
      ),
    );
  }
}

final _myKey = LabeledGlobalKey('MyKey');"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s">'package:flutter/material.dart'</span>;

<span class="pl-k">void</span> <span class="pl-en">main</span>() {
  <span class="pl-k">return</span> <span class="pl-en">runApp</span>(<span class="pl-c1">MyApp</span>());
}

<span class="pl-k">class</span> <span class="pl-c1">MyApp</span> <span class="pl-k">extends</span> <span class="pl-c1">StatelessWidget</span> {
  <span class="pl-k">@override</span>
  <span class="pl-c1">Widget</span> <span class="pl-en">build</span>(<span class="pl-c1">BuildContext</span> context) {
    <span class="pl-k">return</span> <span class="pl-c1">MaterialApp</span>(
      home<span class="pl-k">:</span> <span class="pl-c1">MyHomePage</span>(),
    );
  }
}

<span class="pl-k">class</span> <span class="pl-c1">MyHomePage</span> <span class="pl-k">extends</span> <span class="pl-c1">StatelessWidget</span> {
  <span class="pl-c1">MyHomePage</span>({<span class="pl-c1">Key</span> key}) <span class="pl-k">:</span> <span class="pl-c1">super</span>(key<span class="pl-k">:</span> key);

  <span class="pl-k">@override</span>
  <span class="pl-c1">Widget</span> <span class="pl-en">build</span>(<span class="pl-c1">BuildContext</span> context) {
    <span class="pl-k">return</span> <span class="pl-c1">Container</span>(
      <span class="pl-c">// XXX: Removing (or adding) the following line and doing a hot-reload</span>
      <span class="pl-c">//      triggers a framework assertion.  Hot restart is fine.</span>
      padding<span class="pl-k">:</span> <span class="pl-k">const</span> <span class="pl-c1">EdgeInsets</span>.<span class="pl-en">all</span>(<span class="pl-c1">5</span>),
      child<span class="pl-k">:</span> <span class="pl-c1">Container</span>(
        constraints<span class="pl-k">:</span> <span class="pl-k">const</span> <span class="pl-c1">BoxConstraints</span>(minHeight<span class="pl-k">:</span> <span class="pl-c1">200</span>, maxHeight<span class="pl-k">:</span> <span class="pl-c1">200</span>),
        child<span class="pl-k">:</span> <span class="pl-c1">GridView</span>.<span class="pl-en">count</span>(
          key<span class="pl-k">:</span> _myKey,
          crossAxisCount<span class="pl-k">:</span> <span class="pl-c1">2</span>,
          children<span class="pl-k">:</span> <span class="pl-k">&lt;</span><span class="pl-c1">Widget</span><span class="pl-k">&gt;</span>[<span class="pl-c1">Placeholder</span>(), <span class="pl-c1">Placeholder</span>()],
        ),
      ),
    );
  }
}

<span class="pl-k">final</span> _myKey <span class="pl-k">=</span> <span class="pl-c1">LabeledGlobalKey</span>(<span class="pl-s">'MyKey'</span>);</pre></div>
<h2 dir="auto">Doctor</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ flutter doctor -v

[✓] Flutter (Channel unknown, v0.10.2-pre.81, on Linux, locale en_US.UTF-8)
    • Flutter version 0.10.2-pre.81 at /home/jamesdlin/git/flutter/flutter
    • Framework revision 26131d917a (2 weeks ago), 2018-10-23 17:36:25 -0700
    • Engine revision 3236b49cea
    • Dart version 2.1.0 (build 2.1.0-dev.8.0 bf26f760b1)

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at /home/jamesdlin/Android/Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /home/jamesdlin/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[✓] Android Studio (version 3.2)
    • Android Studio at /home/jamesdlin/android-studio
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[✓] VS Code (version 1.28.1)
    • VS Code at /usr/share/code
    • Flutter extension version 2.19.0

[✓] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)

• No issues found!"><pre class="notranslate"><code class="notranslate">$ flutter doctor -v

[✓] Flutter (Channel unknown, v0.10.2-pre.81, on Linux, locale en_US.UTF-8)
    • Flutter version 0.10.2-pre.81 at /home/jamesdlin/git/flutter/flutter
    • Framework revision 26131d917a (2 weeks ago), 2018-10-23 17:36:25 -0700
    • Engine revision 3236b49cea
    • Dart version 2.1.0 (build 2.1.0-dev.8.0 bf26f760b1)

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at /home/jamesdlin/Android/Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /home/jamesdlin/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[✓] Android Studio (version 3.2)
    • Android Studio at /home/jamesdlin/android-studio
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[✓] VS Code (version 1.28.1)
    • VS Code at /usr/share/code
    • Flutter extension version 2.19.0

[✓] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)

• No issues found!
</code></pre></div>