Flutter异常'package:flutter / src / widgets / sliver.dart':失败的断言'child!= null'不是true

时间:2019-03-31 11:20:56

标签: dart flutter

当我导航到新页面时,我从flutter包sliver.dart中获得了此异常。

所有这些都工作正常,但是后来我尝试向其添加多个功能,例如连接sqlite数据库,我认为这就是问题所在,因此我尝试通过删除所有其他功能来返回到应用的最后工作状态码。但不幸的是,它仍然给我这个错误。即使您在下面查看我的前端代码,现在也没有什么特别的,它只是显示对象中已有的数据。

尝试完全重新安装该应用程序,但仍然没有解决方案。

Running "flutter packages get" in heron...                          1.5s
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Built build\app\outputs\apk\debug\app-debug.apk.
D/        (23206): HostConnection::get() New Host Connection established 0xa4b249c0, tid 23228
D/EGL_emulation(23206): eglMakeCurrent: 0xa6594cc0: ver 3 0 (tinfo 0x94a360d0)
I/flutter (23206): TV GET Requested
I/flutter (23206): Movie GET Requested
I/flutter (23206): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (23206): The following assertion was thrown during performLayout():
I/flutter (23206): 'package:flutter/src/widgets/sliver.dart': Failed assertion: line 553 pos 12: 'child != null': is
I/flutter (23206): not true.
I/flutter (23206): 
I/flutter (23206): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (23206): more information in this error message to help you determine and fix the underlying cause.
I/flutter (23206): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (23206):   https://github.com/flutter/flutter/issues/new?template=BUG.md
I/flutter (23206): 
I/flutter (23206): When the exception was thrown, this was the stack:
I/flutter (23206): #2      SliverChildListDelegate.build 
I/flutter (23206): #3      SliverMultiBoxAdaptorElement._build.<anonymous closure> 
I/flutter (23206): #4      _HashMap.putIfAbsent (dart:collection/runtime/libcollection_patch.dart:137:29)
I/flutter (23206): #5      SliverMultiBoxAdaptorElement._build 
I/flutter (23206): #6      SliverMultiBoxAdaptorElement.createChild.<anonymous closure> 
I/flutter (23206): #7      BuildOwner.buildScope 
I/flutter (23206): #8      SliverMultiBoxAdaptorElement.createChild 
I/flutter (23206): #9      RenderSliverMultiBoxAdaptor._createOrObtainChild.<anonymous closure> 
I/flutter (23206): #10     RenderObject.invokeLayoutCallback.<anonymous closure> 
I/flutter (23206): #11     PipelineOwner._enableMutationsToDirtySubtrees 
I/flutter (23206): #12     RenderObject.invokeLayoutCallback 
I/flutter (23206): #13     RenderSliverMultiBoxAdaptor._createOrObtainChild 
I/flutter (23206): #14     RenderSliverMultiBoxAdaptor.insertAndLayoutChild 
I/flutter (23206): #15     RenderSliverList.performLayout.advance 
I/flutter (23206): #16     RenderSliverList.performLayout 
I/flutter (23206): #17     RenderObject.layout 
I/flutter (23206): #18     RenderSliverPadding.performLayout 
I/flutter (23206): #19     RenderObject.layout 
I/flutter (23206): #20     RenderViewportBase.layoutChildSequence 
I/flutter (23206): #21     RenderViewport._attemptLayout 
I/flutter (23206): #22     RenderViewport.performLayout 
I/flutter (23206): #23     RenderObject.layout 
I/flutter (23206): #24     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter (23206): #25     RenderObject.layout 
I/flutter (23206): #26     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter (23206): #27     RenderObject.layout 
I/flutter (23206): #28     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter (23206): #29     RenderObject.layout 
I/flutter (23206): #30     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter (23206): #31     RenderObject.layout 
I/flutter (23206): #32     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter (23206): #33     RenderObject.layout 
I/flutter (23206): #34     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter (23206): #35     RenderObject.layout 
I/flutter (23206): #36     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter (23206): #37     RenderObject.layout 
I/flutter (23206): #38     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter (23206): #39     RenderObject.layout 
I/flutter (23206): #40     RenderPadding.performLayout 
I/flutter (23206): #41     RenderObject.layout 
I/flutter (23206): #42     MultiChildLayoutDelegate.layoutChild 
I/flutter (23206): #43     _ScaffoldLayout.performLayout 
I/flutter (23206): #44     MultiChildLayoutDelegate._callPerformLayout 
I/flutter (23206): #45     RenderCustomMultiChildLayoutBox.performLayout 
I/flutter (23206): #46     RenderObject.layout 
I/flutter (23206): #47     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter (23206): #48     RenderObject.layout 
I/flutter (23206): #49     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter (23206): #50     _RenderCustomClip.performLayout 
I/flutter (23206): #51     RenderObject.layout 
I/flutter (23206): #52     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter (23206): #53     RenderObject.layout 
I/flutter (23206): #54     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter (23206): #55     RenderObject.layout 
I/flutter (23206): #56     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter (23206): #57     RenderObject.layout 
I/flutter (23206): #58     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter (23206): #59     RenderObject.layout 
I/flutter (23206): #60     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter (23206): #61     RenderObject.layout 
I/flutter (23206): #62     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter (23206): #63     RenderObject.layout 
I/flutter (23206): #64     _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout 
I/flutter (23206): #65     RenderObject.layout 
I/flutter (23206): #66     RenderOffstage.performLayout 
I/flutter (23206): #67     RenderObject.layout 
I/flutter (23206): #68     RenderStack.performLayout 
I/flutter (23206): #69     RenderObject._layoutWithoutResize 
I/flutter (23206): #70     PipelineOwner.flushLayout 
I/flutter (23206): #71     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame 
I/flutter (23206): #72     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame 
I/flutter (23206): #73     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback 
I/flutter (23206): #74     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback 
I/flutter (23206): #75     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame 
I/flutter (23206): #76     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame 
I/flutter (23206): #80     _invoke (dart:ui/hooks.dart:209:10)
I/flutter (23206): #81     _drawFrame (dart:ui/hooks.dart:168:3)
I/flutter (23206): (elided 5 frames from class _AssertionError and package dart:async)
I/flutter (23206): 
I/flutter (23206): The following RenderObject was being processed when the exception was fired:
I/flutter (23206):   RenderSliverList#19980 relayoutBoundary=up2 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (23206):   creator: SliverList ← MediaQuery ← SliverPadding ← Viewport ← IgnorePointer-[GlobalKey#7290e] ←
I/flutter (23206):   Semantics ← Listener ← _GestureSemantics ←
I/flutter (23206):   RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#9ea0f] ← _ScrollableScope ←
I/flutter (23206):   _ScrollSemantics-[GlobalKey#aa43f] ← RepaintBoundary ← ⋯
I/flutter (23206):   parentData: paintOffset=Offset(0.0, 0.0) (can use size)
I/flutter (23206):   constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle,
I/flutter (23206):   scrollOffset: 0.0, remainingPaintExtent: 598.4, crossAxisExtent: 381.4, crossAxisDirection:
I/flutter (23206):   AxisDirection.right, viewportMainAxisExtent: 598.4, remainingCacheExtent: 848.4 cacheOrigin: 0.0 )
I/flutter (23206):   geometry: null
I/flutter (23206):   currently live children: 0 to 2
I/flutter (23206): This RenderObject had the following descendants (showing up to depth 5):
I/flutter (23206):   RenderIndexedSemantics#6d89b relayoutBoundary=up3 NEEDS-PAINT
I/flutter (23206):     RenderRepaintBoundary#41a15 relayoutBoundary=up4 NEEDS-PAINT
I/flutter (23206):       RenderConstrainedBox#f6331 relayoutBoundary=up5 NEEDS-PAINT
I/flutter (23206):         RenderStack#1d492 NEEDS-PAINT
I/flutter (23206):           RenderSemanticsAnnotations#dee5b relayoutBoundary=up1 NEEDS-PAINT
I/flutter (23206):           RenderSemanticsAnnotations#75402 NEEDS-PAINT
I/flutter (23206):           RenderConstrainedBox#553a7 relayoutBoundary=up1 NEEDS-PAINT
I/flutter (23206):   RenderIndexedSemantics#dbd86 relayoutBoundary=up3 NEEDS-PAINT
I/flutter (23206):     RenderRepaintBoundary#d9292 relayoutBoundary=up4 NEEDS-PAINT
I/flutter (23206):       RenderDecoratedBox#fdc4c relayoutBoundary=up5 NEEDS-PAINT
I/flutter (23206):         RenderSemanticsGestureHandler#fac22 relayoutBoundary=up6 NEEDS-PAINT
I/flutter (23206):           RenderPointerListener#bca58 relayoutBoundary=up7 NEEDS-PAINT
I/flutter (23206):   RenderIndexedSemantics#dc7c8 relayoutBoundary=up3 NEEDS-PAINT
I/flutter (23206):     RenderRepaintBoundary#f0361 relayoutBoundary=up4 NEEDS-PAINT
I/flutter (23206):       RenderSemanticsGestureHandler#29897 relayoutBoundary=up5 NEEDS-PAINT
I/flutter (23206):         RenderPointerListener#e3417 relayoutBoundary=up6 NEEDS-PAINT
I/flutter (23206):           RenderSemanticsAnnotations#69a6f relayoutBoundary=up7 NEEDS-PAINT
I/flutter (23206): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (23206): Another exception was thrown: NoSuchMethodError: The getter 'scrollOffsetCorrection' was called on null.
I/flutter (23206): Another exception was thrown: NoSuchMethodError: The method 'debugAssertIsValid' was called on null.
I/flutter (23206): Another exception was thrown: NoSuchMethodError: The getter 'visible' was called on null.

我已将代码分为两页

前端-https://gist.github.com/purplecandy/54234b2080f27b43075ef289489ecf5b

功能-https://gist.github.com/purplecandy/8d7a8cb0e3e001d6517ddc21dde72256

pubspec-https://gist.github.com/purplecandy/06be5d9a521239052a25cbe6e042471b

任何人都可以给我一些见解导致此问题的原因吗?我哪里错了?或者只是向我解释错误

1 个答案:

答案 0 :(得分:0)

根据日志,Widget 的预期 child 似乎为空。如果您仍然遇到问题,分享导致错误的行的代码片段应该有助于我们理解问题。