我不知道为什么会收到此错误。在我重新启动应用程序而不更改任何代码后,我收到此错误。它似乎与firebase_database
插件有关,但我不知道是什么导致了这个问题。
我正在使用Dart 2预览
错误
I/flutter ( 3221): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 3221): The following assertion was thrown building MealList:
I/flutter ( 3221): type '(DatabaseError) => void' is not a subtype of type '(Object) => FutureOr'
I/flutter ( 3221):
I/flutter ( 3221): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter ( 3221): more information in this error message to help you determine and fix the underlying cause.
I/flutter ( 3221): In either case, please report this assertion by filing a bug on GitHub:
I/flutter ( 3221): https://github.com/flutter/flutter/issues/new
I/flutter ( 3221):
I/flutter ( 3221): When the exception was thrown, this was the stack:
I/flutter ( 3221): #3 new _ControllerSubscription (dart:async/stream_controller.dart)
I/flutter ( 3221): #4 new _BroadcastSubscription (dart:async/broadcast_stream_controller.dart)
I/flutter ( 3221): #8 _ListBase&StreamSubscriberMixin^#U0^#U1.listen (package:firebase_database/ui/utils/stream_subscriber_mixin.dart:15:33)
I/flutter ( 3221): #9 new FirebaseList (package:firebase_database/ui/firebase_list.dart:32:5)
I/flutter ( 3221): #10 FirebaseAnimatedListState.didChangeDependencies (package:firebase_database/ui/firebase_animated_list.dart:153:20)
I/flutter ( 3221): #11 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3739:12)
I/flutter ( 3221): #12 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3600:5)
I/flutter ( 3221): #13 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2890:14)
I/flutter ( 3221): #14 Element.updateChild (package:flutter/src/widgets/framework.dart:2693:12)
I/flutter ( 3221): #15 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3636:16)
I/flutter ( 3221): #16 Element.rebuild (package:flutter/src/widgets/framework.dart:3478:5)
I/flutter ( 3221): #17 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3605:5)
I/flutter ( 3221): #18 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3600:5)
I/flutter ( 3221): #19 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2890:14)
I/flutter ( 3221): #20 Element.updateChild (package:flutter/src/widgets/framework.dart:2693:12)
I/flutter ( 3221): #21 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4611:14)
I/flutter ( 3221): #22 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2890:14)
I/flutter ( 3221): #23 Element.updateChild (package:flutter/src/widgets/framework.dart:2693:12)
I/flutter ( 3221): #24 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3636:16)
I/flutter ( 3221): #25 Element.rebuild (package:flutter/src/widgets/framework.dart:3478:5)
I/flutter ( 3221): #26 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3605:5)
I/flutter ( 3221): #27 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3600:5)
I/flutter ( 3221): #28 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2890:14)
I/flutter ( 3221): #29 Element.updateChild (package:flutter/src/widgets/framework.dart:2693:12)
I/flutter ( 3221): #30 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3636:16)
I/flutter ( 3221): #31 Element.rebuild (package:flutter/src/widgets/framework.dart:3478:5)
I/flutter ( 3221): #32 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3605:5)
I/flutter ( 3221): #33 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3600:5)
I/flutter ( 3221): #34 ParentDataElement.mount (package:flutter/src/widgets/framework.dart:3916:11)
I/flutter ( 3221): #35 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2890:14)
I/flutter ( 3221): #36 Element.updateChild (package:flutter/src/widgets/framework.dart:2693:12)
I/flutter ( 3221): #37 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3636:16)
I/flutter ( 3221): #38 Element.rebuild (package:flutter/src/widgets/framework.dart:3478:5)
I/flutter ( 3221): #39 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3605:5)
I/flutter ( 3221): #40 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3741:11)
I/flutter ( 3221): #41 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3600:5)
I/flutter ( 3221): #42 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2890:14)
I/flutter ( 3221): #43 Element.updateChild (package:flutter/src/widgets/framework.dart:2693:12)
I/flutter ( 3221): #44 SliverMultiBoxAdaptorElement.createChild.<anonymous closure> (package:flutter/src/widgets/sliver.dart:729:20)
I/flutter ( 3221): #45 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2205:19)
I/flutter ( 3221): #46 SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:722:11)
I/flutter ( 3221): #47 RenderSliverMultiBoxAdaptor._createOrObtainChild.<anonymous closure> (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:254:23)
I/flutter ( 3221): #48 RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1666:58)
I/flutter ( 3221): #49 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:740:15)
I/flutter ( 3221): #50 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1666:13)
I/flutter ( 3221): #51 RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:243:5)
I/flutter ( 3221): #52 RenderSliverMultiBoxAdaptor.addInitialChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:351:5)
I/flutter ( 3221): #53 RenderSliverFixedExtentBoxAdaptor.performLayout (package:flutter/src/rendering/sliver_fixed_extent_list.dart:169:12)
I/flutter ( 3221): #54 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #55 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:285:13)
I/flutter ( 3221): #56 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1008:12)
I/flutter ( 3221): #57 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:932:20)
I/flutter ( 3221): #58 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #59 __RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin^^#U0^.performLayout (package:flutter/src/rendering/proxy_box.dart:107:13)
I/flutter ( 3221): #60 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #61 __RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin^^#U0^.performLayout (package:flutter/src/rendering/proxy_box.dart:107:13)
I/flutter ( 3221): #62 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #63 __RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin^^#U0^.performLayout (package:flutter/src/rendering/proxy_box.dart:107:13)
I/flutter ( 3221): #64 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #65 __RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin^^#U0^.performLayout (package:flutter/src/rendering/proxy_box.dart:107:13)
I/flutter ( 3221): #66 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #67 __RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin^^#U0^.performLayout (package:flutter/src/rendering/proxy_box.dart:107:13)
I/flutter ( 3221): #68 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #69 __RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin^^#U0^.performLayout (package:flutter/src/rendering/proxy_box.dart:107:13)
I/flutter ( 3221): #70 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #71 __RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin^^#U0^.performLayout (package:flutter/src/rendering/proxy_box.dart:107:13)
I/flutter ( 3221): #72 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #73 __RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin^^#U0^.performLayout (package:flutter/src/rendering/proxy_box.dart:107:13)
I/flutter ( 3221): #74 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #75 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:124:11)
I/flutter ( 3221): #76 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:256:7)
I/flutter ( 3221): #77 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:194:7)
I/flutter ( 3221): #78 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:338:14)
I/flutter ( 3221): #79 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #80 __RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin^^#U0^.performLayout (package:flutter/src/rendering/proxy_box.dart:107:13)
I/flutter ( 3221): #81 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #82 __RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin^^#U0^.performLayout (package:flutter/src/rendering/proxy_box.dart:107:13)
I/flutter ( 3221): #83 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1138:11)
I/flutter ( 3221): #84 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #85 __RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin^^#U0^.performLayout (package:flutter/src/rendering/proxy_box.dart:107:13)
I/flutter ( 3221): #86 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #87 __RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin^^#U0^.performLayout (package:flutter/src/rendering/proxy_box.dart:107:13)
I/flutter ( 3221): #88 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #89 __RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin^^#U0^.performLayout (package:flutter/src/rendering/proxy_box.dart:107:13)
I/flutter ( 3221): #90 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #91 __RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin^^#U0^.performLayout (package:flutter/src/rendering/proxy_box.dart:107:13)
I/flutter ( 3221): #92 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #93 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:2708:14)
I/flutter ( 3221): #94 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #95 __RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin^^#U0^.performLayout (package:flutter/src/rendering/proxy_box.dart:107:13)
I/flutter ( 3221): #96 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter ( 3221): #97 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:509:15)
I/flutter ( 3221): #98 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1445:7)
I/flutter ( 3221): #99 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:709:18)
I/flutter ( 3221): #100 _____BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:270:19)
I/flutter ( 3221): #101 ______BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:622:13)
I/flutter ( 3221): #102 _____BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:208:5)
I/flutter ( 3221): #103 ___BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
I/flutter ( 3221): #104 ___BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
I/flutter ( 3221): #105 ___BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:842:5)
I/flutter ( 3221): #106 _invoke (dart:ui/hooks.dart:120:13)
I/flutter ( 3221): #107 _drawFrame (dart:ui/hooks.dart:109:3)
I/flutter ( 3221): (elided 6 frames from package dart:async)
I/flutter ( 3221): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter ( 3221): Another exception was thrown: type '(DatabaseError) => void' is not a subtype of type '(Object) => FutureOr'
代码
return new FirebaseAnimatedList(
//defaultChild: CircularProgressIndicator(),
query: FirebaseDatabase.instance
.reference()
.child("meals/${this.tabSelector}"),
itemBuilder: (BuildContext context, DataSnapshot meals,
Animation animation, int index) {
return new MealCard(
index: index,
meals: meals,
);
},
);