Fix sliver padding assertion failure that sometimes happens during startup because the app is temporarily built with zero size #10186
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Update: this is landed in 973304d and merged in 04923d3
Here's the error this fixes.
Launching lib/main.dart on Nexus 5X in debug mode...
Built build/app/outputs/apk/app-debug.apk (24.9MB).
I/flutter (32037): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (32037): The following assertion was thrown during performLayout():
I/flutter (32037): SliverConstraints is not valid: The "crossAxisExtent" is negative.
I/flutter (32037): These invalid constraints were provided to RenderSliverList's layout() function by the following
I/flutter (32037): function, which probably computed the invalid constraints in question:
I/flutter (32037): RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:144)
I/flutter (32037): The offending constraints were:
I/flutter (32037): SliverConstraints(AxisDirection.up, GrowthDirection.forward, ScrollDirection.idle, scrollOffset:
I/flutter (32037): 0.0, remainingPaintExtent: 0.0, crossAxisExtent: -16.0, viewportMainAxisExtent: 0.0)
I/flutter (32037): When the exception was thrown, this was the stack:
I/flutter (32037): #0 SliverConstraints.debugAssertIsValid..verify (package:flutter/src/rendering/sliver.dart:409)
I/flutter (32037): #1 SliverConstraints.debugAssertIsValid. (package:flutter/src/rendering/sliver.dart:419)
I/flutter (32037): #3 SliverConstraints.debugAssertIsValid (package:flutter/src/rendering/sliver.dart:402)
I/flutter (32037): #4 RenderObject.layout (package:flutter/src/rendering/object.dart:1787)
I/flutter (32037): #5 RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:144)
I/flutter (32037): #6 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #7 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:245)
I/flutter (32037): #8 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:877)
I/flutter (32037): #9 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:801)
I/flutter (32037): #10 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #11 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #12 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #13 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #14 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #15 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #16 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #17 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #18 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #19 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #20 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #21 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #22 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #23 RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:560)
I/flutter (32037): #24 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #25 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:124)
I/flutter (32037): #26 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:85)
I/flutter (32037): #27 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:194)
I/flutter (32037): #28 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:338)
I/flutter (32037): #29 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #30 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #31 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #32 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #33 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:984)
I/flutter (32037): #34 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #35 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #36 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #37 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #38 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #39 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #40 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #41 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #42 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:2542)
I/flutter (32037): #43 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #44 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #45 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #46 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:433)
I/flutter (32037): #47 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #48 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #49 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #50 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #51 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #52 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #53 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #54 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #55 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #56 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:100)
I/flutter (32037): #57 RenderObject.layout (package:flutter/src/rendering/object.dart:1870)
I/flutter (32037): #58 RenderView.performLayout (package:flutter/src/rendering/view.dart:120)
I/flutter (32037): #59 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1747)
I/flutter (32037): #60 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1048)
I/flutter (32037): #61 BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:232)
I/flutter (32037): #62 BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:361)
I/flutter (32037): #63 BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:170)
I/flutter (32037): #64 BindingBase&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:685)
I/flutter (32037): #65 BindingBase&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:633)
I/flutter (32037): #66 BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding.scheduleWarmUpFrame. (package:flutter/src/rendering/binding.dart:247)
I/flutter (32037): #68 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:366)
I/flutter (32037): #69 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:394)
I/flutter (32037): #70 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151)
I/flutter (32037): (elided 2 frames from class _AssertionError and package dart:async-patch)
I/flutter (32037): The following RenderObject was being processed when the exception was fired:
I/flutter (32037): RenderSliverPadding#95484281 relayoutBoundary=up1 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (32037): creator: SliverPadding ← Viewport ← _ScrollableScope ← IgnorePointer-[GlobalKey#473328140] ←
I/flutter (32037): Listener ← _GestureSemantics ←
I/flutter (32037): RawGestureDetector-[LabeledGlobalKey#449875545] ← RepaintBoundary ←
I/flutter (32037): CustomPaint ← RepaintBoundary ← NotificationListener ←
I/flutter (32037): GlowingOverscrollIndicator ← ⋯
I/flutter (32037): parentData: paintOffset=Offset(0.0, 0.0) (can use size)
I/flutter (32037): constraints: SliverConstraints(AxisDirection.up, GrowthDirection.forward, ScrollDirection.idle,
I/flutter (32037): scrollOffset: 0.0, remainingPaintExtent: 0.0, crossAxisExtent: 0.0, viewportMainAxisExtent: 0.0)
I/flutter (32037): geometry: null
I/flutter (32037): This RenderObject had the following child:
I/flutter (32037): RenderSliverList#57082544 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (32037): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (32037): Another exception was thrown: NoSuchMethodError: The getter 'debugAssertIsValid' was called on null.
I/flutter (32037): Another exception was thrown: NoSuchMethodError: The getter 'visible' was called on null.