SchedulerBinding vs WidgetsBinding - flutter

Actually I am working on Login page with Bloc. So when I press submit button, it does business logic on bloc then trying to navigate to home page based on the result. I tried this
Widget submitButton() {
return StreamBuilder(
stream: bloc.submitStream,
builder: (context, snapshot) {
if (snapshot.data == "Success") {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RegisterPage(),
),
);
}
return RaisedButton(
child: Text("Submit"),
onPressed: () {
bloc.submitSink.add(null);
},
);
},
);
}
But I got error like this The widget which was currently being built when the offending call was made....
Later then I found two solution:
1. Using SchedulerBinding,
2. Using WidgetsBinding. So what is the difference between SchedulerBinding and WidgetsBinding. Which one do I have to use?
Full Error Log:
I/flutter (17893): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (17893): The following assertion was thrown building LayoutBuilder:
I/flutter (17893): setState() or markNeedsBuild() called during build.
I/flutter (17893): This Overlay widget cannot be marked as needing to build because the framework is already in the
I/flutter (17893): process of building widgets. A widget can be marked as needing to be built during the build phase
I/flutter (17893): only if one of its ancestors is currently building. This exception is allowed because the framework
I/flutter (17893): builds parent widgets before children, which means a dirty descendant will always be built.
I/flutter (17893): Otherwise, the framework might not visit this widget during this build phase.
I/flutter (17893): The widget on which setState() or markNeedsBuild() was called was:
I/flutter (17893): Overlay-[LabeledGlobalKey<OverlayState>#70089](state: OverlayState#3bf13(entries:
I/flutter (17893): [OverlayEntry#9280a(opaque: false; maintainState: false), OverlayEntry#1af87(opaque: false;
I/flutter (17893): maintainState: true), OverlayEntry#9fb49(opaque: false; maintainState: false),
I/flutter (17893): OverlayEntry#87589(opaque: false; maintainState: true)]))
I/flutter (17893): The widget which was currently being built when the offending call was made was:
I/flutter (17893): LayoutBuilder(renderObject: _RenderLayoutBuilder#d3baf relayoutBoundary=up1 NEEDS-LAYOUT
I/flutter (17893): NEEDS-PAINT)
I/flutter (17893):
I/flutter (17893): When the exception was thrown, this was the stack:
I/flutter (17893): #0 Element.markNeedsBuild.<anonymous closure> (package:flutter/src/widgets/framework.dart:3497:11)
I/flutter (17893): #1 Element.markNeedsBuild (package:flutter/src/widgets/framework.dart:3523:6)
I/flutter (17893): #2 State.setState (package:flutter/src/widgets/framework.dart:1138:14)
I/flutter (17893): #3 OverlayState.insertAll (package:flutter/src/widgets/overlay.dart:301:5)
I/flutter (17893): #4 OverlayRoute.install (package:flutter/src/widgets/routes.dart:43:24)
I/flutter (17893): #5 TransitionRoute.install (package:flutter/src/widgets/routes.dart:184:11)
I/flutter (17893): #6 ModalRoute.install (package:flutter/src/widgets/routes.dart:899:11)
I/flutter (17893): #7 NavigatorState.push (package:flutter/src/widgets/navigator.dart:1672:11)
I/flutter (17893): #8 Navigator.push (package:flutter/src/widgets/navigator.dart:1011:34)
I/flutter (17893): #9 _SetPinPageState.submitButton (package:technicalreport/screens/set_pin_page.dart:94:15)
I/flutter (17893): #10 _SetPinPageState.build.<anonymous closure>.<anonymous closure> (package:technicalreport/screens/set_pin_page.dart:52:29)
I/flutter (17893): #11 OrientationBuilder._buildWithConstraints (package:flutter/src/widgets/orientation_builder.dart:48:12)
I/flutter (17893): #12 _LayoutBuilderElement._layout.<anonymous closure> (package:flutter/src/widgets/layout_builder.dart:111:26)
I/flutter (17893): #13 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2253:19)
I/flutter (17893): #14 _LayoutBuilderElement._layout (package:flutter/src/widgets/layout_builder.dart:107:11)
I/flutter (17893): #15 RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1728:58)
I/flutter (17893): #16 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:797:15)
I/flutter (17893): #17 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1728:13)
I/flutter (17893): #18 _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:205:5)
I/flutter (17893): #19 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #20 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:142:11)
I/flutter (17893): #21 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:350:7)
I/flutter (17893): #22 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:212:7)
I/flutter (17893): #23 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:356:14)
I/flutter (17893): #24 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #25 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #26 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #27 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #28 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1206:11)
I/flutter (17893): #29 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #30 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #31 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #32 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #33 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #34 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #35 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #36 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #37 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #38 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #39 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #40 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #41 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #42 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #43 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #44 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #45 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3032:13)
I/flutter (17893): #46 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #47 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:510:15)
I/flutter (17893): #48 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #49 __RenderTheatre&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #50 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #51 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #52 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #53 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #54 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #55 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #56 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #57 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #58 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #59 RenderView.performLayout (package:flutter/src/rendering/view.dart:151:13)
I/flutter (17893): #60 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1507:7)
I/flutter (17893): #61 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:766:18)
I/flutter (17893): #62 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:329:19)
I/flutter (17893): #63 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:701:13)
I/flutter (17893): #64 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:268:5)
I/flutter (17893): #65 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:988:15)
I/flutter (17893): #66 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:928:9)
I/flutter (17893): #67 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:749:7)
I/flutter (17893): #76 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
I/flutter (17893): #77 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
I/flutter (17893): #78 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
I/flutter (17893): (elided 8 frames from package dart:async)
I/flutter (17893): ════════════════════════════════════════════════════════════════════════════════════════════════════
D/ (17893): HostConnection::get() New Host Connection established 0xa0ba6b40, tid 17931
D/EGL_emulation(17893): eglMakeCurrent: 0xa3508c40: ver 2 0 (tinfo 0x9084ab40)

There are three callbacks available in flutter which rendering flutter widgets.
Transient callbacks: triggered by the system’s [Window.onBeginFrame] callback, for synchronizing the application’s behavior to the system’s display. For example, [Ticker]s and [AnimationController]s trigger from these.
Persistent callbacks: triggered by the system’s [Window.onDrawFrame] callback, for updating the system’s display after transient callbacks have executed. For example, the rendering layer uses this to drive its rendering pipeline.
Post-frame callbacks: which are run after persistent callbacks, just before returning from the [Window.onDrawFrame] callback. * Non-rendering tasks, to be run between frames. These are given a priority and are executed in priority order according to a schedulingStrategy.
All above callbacks run sequentially, but for us, the last callback would work i.e Post-frame callbacks
Widgets Binding: The glue between the widgets layer and the Flutter engine. which comes with WidgetsBindingObserver mixin which has many callbacks but one which required to use is didChangeAppLifecycleState that returns AppLifecycleState.
Scheduler Binding: This is also similar to WidgetBinding but it does not provide any life cycle callbacks.
The below binding example would be called exactly the ones, means print statement like WidgetsBinding & SchedulerBinding will be printed only once as we called it initState(), but it will be called when build method finished it’s rendering.
void initState() {
super.initState();
print("initState");
WidgetsBinding.instance.addPostFrameCallback((_) {
print("WidgetsBinding");
});
SchedulerBinding.instance.addPostFrameCallback((_) {
print("SchedulerBinding");
});
}

Both solutions do the same.
WidgetsBinding inherits this Method from SchedulerBinding
https://api.flutter.dev/flutter/widgets/WidgetsBinding-mixin.html
It registers a callback that will be called after the frame is build.
See in the docs:
https://api.flutter.dev/flutter/scheduler/SchedulerBinding/addPostFrameCallback.html

Related

Getting EXCEPTION CAUGHT BY WIDGETS LIBRARY & Failed assertion: line 3289 pos 12: '!_debugLocked': is not true

From the code below, I would have the the widget _buildResultsWidget with a condition where it would move to a new state and from there when the new page is reached it would stay on for 2 seconds where is would returned me back but there would be an error appearing the moment the condition is activated.
import '../main.dart';
class DetectScreen extends StatefulWidget {
DetectScreen({Key key, this.title}) : super(key: key);
final String title;
#override
_DetectScreenPageState createState() => _DetectScreenPageState();
}
class _DetectScreenPageState extends State<DetectScreen>
with TickerProviderStateMixin {
AnimationController _colorAnimController;
Animation _colorTween;
bool open = false;
List<Result> outputs;
void initState() {
super.initState();
//Load TFLite Model
TFLiteHelper.loadModel().then((value) {
setState(() {
TFLiteHelper.modelLoaded = true;
});
});
//Initialize Camera
CameraHelper.initializeCamera();
//Setup Animation
_setupAnimation();
//Subscribe to TFLite's Classify events
TFLiteHelper.tfLiteResultsController.stream.listen((value) {
value.forEach((element) {
_colorAnimController.animateTo(element.confidence,
curve: Curves.bounceIn, duration: Duration(milliseconds: 500));
});
//Set Results
outputs = value;
//Update results on screen
setState(() {
//Set bit to false to allow detection again
CameraHelper.isDetecting = false;
});
}, onDone: () {
}, onError: (error) {
AppHelper.log("listen", error);
});
}
Widget _buildResultsWidget(double width, List<Result> outputs) {
open = true;
return Positioned.fill(
child: Align(
alignment: Alignment.bottomCenter,
child: Container(
height: 200.0,
width: width,
color: Colors.transparent,
child: outputs != null && outputs.isNotEmpty
? ListView.builder( // check ? if true or false
itemCount: outputs.length,
shrinkWrap: true,
padding: const EdgeInsets.all(20.0),
itemBuilder: (BuildContext context, int index) {
return Column(
children: <Widget>[
Text(
outputs[index].label,
style: TextStyle(
color: _colorTween.value,
fontSize: 20.0,
),
),
(outputs[index].label == "General Waste" && outputs[index].confidence > 0.1) == true ?
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => General(),
),
):
],
);
})
: Center(
child: Text("Wating for model to detect..",
style: TextStyle(
color: Colors.black,
fontSize: 20.0,
))),
),
),
);
}
}
void _setupAnimation() {
_colorAnimController =
AnimationController(vsync: this, duration: Duration(milliseconds: 5000));
_colorTween = ColorTween(begin: Colors.green, end: Colors.red)
.animate(_colorAnimController);
}
}
The condition where the moment it's activated, it would have the error
(outputs[index].label == "General Waste" && outputs[index].confidence > 0.1) == true ?
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => General(),
),
):
The code below where it's suppose to bring me to
class General extends StatefulWidget {
#override
_GeneralState createState() => new _GeneralState();
}
class _GeneralState extends State<General>
{
initState() {
super.initState();
new Timer(const Duration(seconds: 2), onClose); //Timer Here
}
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
backgroundColor: Colors.pink,
title: new Text("General Waste"),
),
);
}
void onClose() {
Navigator.pop(context);
}
And the error would happen the moment the condition is activated
Installing build\app\outputs\apk\app.apk...
I/flutter ( 803): {loadModel} {Loading model..}
I/flutter ( 803): {_initializeCamera} {Initializing camera..}
I/flutter ( 803): {_initializeCamera} {Camera initialized, starting camera stream..}
I/flutter ( 803): {classifyImage} {Results loaded. 1}
I/flutter ( 803): {classifyImage} {0.7169606685638428 , 3, General Waste}
I/flutter ( 803): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 803): The following assertion was thrown building:
I/flutter ( 803): setState() or markNeedsBuild() called during build.
I/flutter ( 803): This Overlay widget cannot be marked as needing to build because the framework is already in the
I/flutter ( 803): process of building widgets. A widget can be marked as needing to be built during the build phase
I/flutter ( 803): only if one of its ancestors is currently building. This exception is allowed because the framework
I/flutter ( 803): builds parent widgets before children, which means a dirty descendant will always be built.
I/flutter ( 803): Otherwise, the framework might not visit this widget during this build phase.
I/flutter ( 803): The widget on which setState() or markNeedsBuild() was called was:
I/flutter ( 803): Overlay-[LabeledGlobalKey<OverlayState>#8b7b3]
I/flutter ( 803): The widget which was currently being built when the offending call was made was:
I/flutter ( 803): SliverList
I/flutter ( 803):
I/flutter ( 803): When the exception was thrown, this was the stack:
I/flutter ( 803): #0 Element.markNeedsBuild.<anonymous closure> (package:flutter/src/widgets/framework.dart:4167:11)
I/flutter ( 803): #1 Element.markNeedsBuild (package:flutter/src/widgets/framework.dart:4182:6)
I/flutter ( 803): #2 State.setState (package:flutter/src/widgets/framework.dart:1253:14)
I/flutter ( 803): #3 OverlayState.rearrange (package:flutter/src/widgets/overlay.dart:415:5)
I/flutter ( 803): #4 NavigatorState._flushHistoryUpdates (package:flutter/src/widgets/navigator.dart:3069:16)
I/flutter ( 803): #5 NavigatorState.push (package:flutter/src/widgets/navigator.dart:3297:5)
I/flutter ( 803): #6 _DetectScreenPageState._buildResultsWidget.<anonymous closure> (package:prototypestart/screens/detect_screen.dart:203:43)
I/flutter ( 803): #7 SliverChildBuilderDelegate.build (package:flutter/src/widgets/sliver.dart:446:22)
I/flutter ( 803): #8 SliverMultiBoxAdaptorElement._build.<anonymous closure> (package:flutter/src/widgets/sliver.dart:1134:67)
I/flutter ( 803): #9 _HashMap.putIfAbsent (dart:collection-patch/collection_patch.dart:139:29)
I/flutter ( 803): #10 SliverMultiBoxAdaptorElement._build (package:flutter/src/widgets/sliver.dart:1134:26)
I/flutter ( 803): #11 SliverMultiBoxAdaptorElement.createChild.<anonymous closure> (package:flutter/src/widgets/sliver.dart:1147:55)
I/flutter ( 803): #12 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2607:19)
I/flutter ( 803): #13 SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1140:11)
I/flutter ( 803): #14 RenderSliverMultiBoxAdaptor._createOrObtainChild.<anonymous closure> (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:354:23)
I/flutter ( 803): #15 RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1866:58)
I/flutter ( 803): #16 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:918:15)
I/flutter ( 803): #17 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1866:13)
I/flutter ( 803): #18 RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:343:5)
I/flutter ( 803): #19 RenderSliverMultiBoxAdaptor.addInitialChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:427:5)
I/flutter ( 803): #20 RenderSliverList.performLayout (package:flutter/src/rendering/sliver_list.dart:79:12)
I/flutter ( 803): #21 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 803): #22 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:135:11)
I/flutter ( 803): #23 RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:375:11)
I/flutter ( 803): #24 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 803): #25 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:452:13)
I/flutter ( 803): #26 RenderShrinkWrappingViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1783:12)
I/flutter ( 803): #27 RenderShrinkWrappingViewport.performLayout (package:flutter/src/rendering/viewport.dart:1741:20)
I/flutter ( 803): #28 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 803): #29 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 803): #30 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 803): #31 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 803): #32 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 803): #33 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 803): #34 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 803): #35 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 803): #36 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 803): #37 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 803): #38 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 803): #39 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 803): #40 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 803): #41 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 803): #42 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 803): #43 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 803): #44 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 803): #45 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 803): #46 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 803): #47 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 803): #48 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1630:7)
I/flutter ( 803): #49 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:887:18)
I/flutter ( 803): #50 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:402:19)
I/flutter ( 803): #51 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:884:13)
I/flutter ( 803): #52 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:284:5)
I/flutter ( 803): #53 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1113:15)
I/flutter ( 803): #54 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1052:9)
I/flutter ( 803): #55 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:968:5)
I/flutter ( 803): #59 _invoke (dart:ui/hooks.dart:261:10)
I/flutter ( 803): #60 _drawFrame (dart:ui/hooks.dart:219:3)
I/flutter ( 803): (elided 3 frames from dart:async)
I/flutter ( 803): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter ( 803): {classifyImage} {Results loaded. 1}
I/flutter ( 803): {classifyImage} {0.754631757736206 , 3, General Waste}
E/flutter ( 803): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 2334 pos 18: '!navigator._debugLocked': is not true.
E/flutter ( 803): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:42:39)
E/flutter ( 803): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:38:5)
E/flutter ( 803): #2 _RouteEntry.handlePush.<anonymous closure> (package:flutter/src/widgets/navigator.dart:2334:18)
E/flutter ( 803): #3 TickerFuture.whenCompleteOrCancel.thunk (package:flutter/src/scheduler/ticker.dart:398:15)
E/flutter ( 803): #4 _rootRunUnary (dart:async/zone.dart:1192:38)
E/flutter ( 803): #5 _CustomZone.runUnary (dart:async/zone.dart:1085:19)
E/flutter ( 803): #6 _FutureListener.handleValue (dart:async/future_impl.dart:141:18)
E/flutter ( 803): #7 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
E/flutter ( 803): #8 Future._propagateToListeners (dart:async/future_impl.dart:711:32)
E/flutter ( 803): #9 Future._completeWithValue (dart:async/future_impl.dart:526:5)
E/flutter ( 803): #10 Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:556:7)
E/flutter ( 803): #11 _rootRun (dart:async/zone.dart:1184:13)
E/flutter ( 803): #12 _CustomZone.run (dart:async/zone.dart:1077:19)
E/flutter ( 803): #13 _CustomZone.runGuarded (dart:async/zone.dart:979:7)
E/flutter ( 803): #14 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1019:23)
E/flutter ( 803): #15 _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
E/flutter ( 803): #16 _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
E/flutter ( 803):
I/flutter ( 803): Another exception was thrown: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 3289 pos 12: '!_debugLocked': is not true.
I/flutter ( 803): {classifyImage} {Results loaded. 1}
I/flutter ( 803): {classifyImage} {0.7490702271461487 , 3, General Waste}
I/flutter ( 803): Another exception was thrown: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 3289 pos 12: '!_debugLocked': is not true.
E/flutter ( 803): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 3289 pos 12: '!_debugLocked': is not true.
E/flutter ( 803): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:42:39)
E/flutter ( 803): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:38:5)
E/flutter ( 803): #2 NavigatorState.push (package:flutter/src/widgets/navigator.dart:3289:12)
E/flutter ( 803): #3 Navigator.push (package:flutter/src/widgets/navigator.dart:1737:34)
E/flutter ( 803): #4 _GeneralState.onClose (package:prototypestart/screens/information.dart:31:15)
E/flutter ( 803): #5 _rootRun (dart:async/zone.dart:1180:38)
E/flutter ( 803): #6 _CustomZone.run (dart:async/zone.dart:1077:19)
E/flutter ( 803): #7 _CustomZone.runGuarded (dart:async/zone.dart:979:7)
E/flutter ( 803): #8 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1019:23)
E/flutter ( 803): #9 _rootRun (dart:async/zone.dart:1184:13)
E/flutter ( 803): #10 _CustomZone.run (dart:async/zone.dart:1077:19)
E/flutter ( 803): #11 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:1003:23)
E/flutter ( 803): #12 Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:23:15)
E/flutter ( 803): #13 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
E/flutter ( 803): #14 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
E/flutter ( 803): #15 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
E/flutter ( 803):
But using RaisedButton works just fine
RaisedButton(
child: Text('General Waste'),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => General()),
);
},
),
This becomes quite simple - there's two ways to do this. The simple way is to
just use a delayed future with zero delay,
which will have dart schedule the call as soon as possible once the current
call stack returns to the event loop:
Future.delayed(Duration.zero, () {
Navigator. ...
});

Invalid argument(s): No host specified in URI file:///p1

Pulling images from the network into a GridView.Builder()
The images are not displayed. View screenshot
Scaffold(
appBar: AppBar(
title: Text('Shoppy'),
),
body: GridView.builder(
padding: const EdgeInsets.all(8.0),
itemCount: loadedProducts.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 3 / 2,
crossAxisSpacing: 8.0,
mainAxisSpacing: 8.0,
),
itemBuilder: (context, index) {
return ProductItem(
loadedProducts[index].id,
loadedProducts[index].imageUrl,
loadedProducts[index].name,
);
}),
);
I/flutter (11127): ══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
I/flutter (11127): The following ArgumentError was thrown resolving an image codec:
I/flutter (11127): Invalid argument(s): No host specified in URI file:///p1
I/flutter (11127):
I/flutter (11127): When the exception was thrown, this was the stack:
I/flutter (11127): #0 _HttpClient._openUrl (dart:_http/http_impl.dart:2313:9)
I/flutter (11127): #1 _HttpClient.getUrl (dart:_http/http_impl.dart:2208:48)
I/flutter (11127): #2 NetworkImage._loadAsync (package:flutter/src/painting/_network_image_io.dart:89:59)
I/flutter (11127): #3 NetworkImage.load (package:flutter/src/painting/_network_image_io.dart:51:14)
I/flutter (11127): #4 ImageProvider.resolveStreamForKey.<anonymous closure> (package:flutter/src/painting/image_provider.dart:503:13)
I/flutter (11127): #5 ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:360:22)
I/flutter (11127): #6 ImageProvider.resolveStreamForKey (package:flutter/src/painting/image_provider.dart:501:80)
I/flutter (11127): #7 ScrollAwareImageProvider.resolveStreamForKey (package:flutter/src/widgets/scroll_aware_image_provider.dart:108:19)
I/flutter (11127): #8 ImageProvider.resolve.<anonymous closure> (package:flutter/src/painting/image_provider.dart:332:9)
I/flutter (11127): #9 ImageProvider._createErrorHandlerAndKey.<anonymous closure>.<anonymous closure> (package:flutter/src/painting/image_provider.dart:462:26)
I/flutter (11127): #10 SynchronousFuture.then (package:flutter/src/foundation/synchronous_future.dart:43:29)
I/flutter (11127): #11 ImageProvider._createErrorHandlerAndKey.<anonymous closure> (package:flutter/src/painting/image_provider.dart:459:11)
I/flutter (11127): #15 ImageProvider._createErrorHandlerAndKey (package:flutter/src/painting/image_provider.dart:451:16)
I/flutter (11127): #16 ImageProvider.resolve (package:flutter/src/painting/image_provider.dart:329:5)
I/flutter (11127): #17 _ImageState._resolveImage (package:flutter/src/widgets/image.dart:1116:16)
I/flutter (11127): #18 _ImageState.didChangeDependencies (package:flutter/src/widgets/image.dart:1069:5)
I/flutter (11127): #19 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4705:12)
I/flutter (11127): #20 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4520:5)
I/flutter (11127): ... Normal element mounting (7 frames)
I/flutter (11127): #27 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
I/flutter (11127): #28 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5991:32)
I/flutter (11127): ... Normal element mounting (48 frames)
I/flutter (11127): #76 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3490:14)
I/flutter (11127): #77 Element.updateChild (package:flutter/src/widgets/framework.dart:3258:18)
I/flutter (11127): #78 SliverMultiBoxAdaptorElement.updateChild (package:flutter/src/widgets/sliver.dart:1164:36)
I/flutter (11127): #79 SliverMultiBoxAdaptorElement.createChild.<anonymous closure> (package:flutter/src/widgets/sliver.dart:1149:20)
I/flutter (11127): #80 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2620:19)
I/flutter (11127): #81 SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1142:11)
I/flutter (11127): #82 RenderSliverMultiBoxAdaptor._createOrObtainChild.<anonymous closure> (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:356:23)
I/flutter (11127): #83 RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1868:58)
I/flutter (11127): #84 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:920:15)
I/flutter (11127): #85 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1868:13)
I/flutter (11127): #86 RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:345:5)
I/flutter (11127): #87 RenderSliverMultiBoxAdaptor.addInitialChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:429:5)
I/flutter (11127): #88 RenderSliverGrid.performLayout (package:flutter/src/rendering/sliver_grid.dart:549:12)
I/flutter (11127): #89 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #90 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:137:11)
I/flutter (11127): #91 RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:377:11)
I/flutter (11127): #92 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #93 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:454:13)
I/flutter (11127): #94 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1445:12)
I/flutter (11127): #95 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1354:20)
I/flutter (11127): #96 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #97 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #98 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #99 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #100 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #101 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #102 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #103 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #104 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #105 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #106 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #107 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #108 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #109 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #110 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #111 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #112 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #113 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #114 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #115 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:173:11)
I/flutter (11127): #116 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:482:7)
I/flutter (11127): #117 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:242:7)
I/flutter (11127): #118 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:401:14)
I/flutter (11127): #119 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #120 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #121 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #122 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #123 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1269:11)
I/flutter (11127): #124 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #125 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #126 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #127 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #128 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #129 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #130 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #131 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #132 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #133 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #134 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #135 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #136 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #137 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #138 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #139 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #140 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3221:13)
I/flutter (11127): #141 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #142 _RenderTheatre.performLayout (package:flutter/src/widgets/overlay.dart:702:15)
I/flutter (11127): #143 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #144 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #145 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #146 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #147 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #148 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #149 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #150 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #151 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #152 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #153 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #154 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
I/flutter (11127): #155 RenderObject.layout (package:flutter/src/rendering/object.dart:1769:7)
I/flutter (11127): #156 RenderView.performLayout (package:flutter/src/rendering/view.dart:169:13)
I/flutter (11127): #157 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (11127): #158 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:889:18)
I/flutter (11127): #159 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:404:19)
I/flutter (11127): #160 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:867:13)
I/flutter (11127): #161 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:286:5)
I/flutter (11127): #162 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1115:15)
I/flutter (11127): #163 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1054:9)
I/flutter (11127): #164 SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:863:7)
I/flutter (11127): (elided 14 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
I/flutter (11127):
I/flutter (11127): Image provider: NetworkImage("p1", scale: 1.0)
I/flutter (11127): Image key: NetworkImage("p1", scale: 1.0)
I/flutter (11127): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (11127): Another exception was thrown: Invalid argument(s): No host specified in URI file:///p2
I/flutter (11127): Another exception was thrown: Invalid argument(s): No host specified in URI file:///p3
I/flutter (11127): Another exception was thrown: Invalid argument(s): No host specified in URI file:///p4
Base from the error that you're, it looks like the Image provider is trying to load "p1" as a NetworkImage. Though from the comments, it's likely that the parameters set in have been incorrectly set. Possibly the id has been switched with the imageUrl.
ProductItem(
loadedProducts[index].id,
loadedProducts[index].imageUrl,
loadedProducts[index].name,
);

Navigating to Another Page From TabBarView's child throws an error

I have a TabBar to switch between login and register, both of them are Stateful widgets.
When the Navigator is commented, there is no error. If Navigator is not commented the error mentioned below is thrown.
Providing relevant code below -
Login/Register Tab View
Flexible(
child: TabBarView(
children: [
Login(), // A Stateful Widget,
Register(),
],
),
),
Login Submit Button -
Padding(
padding: const EdgeInsets.only(top: 20.0),
child: MaterialButton(
color: Theme.of(context).accentColor,
textColor: Colors.white,
onPressed: loginPressed(context),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Text('Login'),
),
),
),
function loginPressed() -
loginPressed(BuildContext context) {
//Will Be conditions here right now redirection for sake of testing
Navigator.pushReplacementNamed(context, 'home');
}
Error -
I/flutter ( 4421): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 4421): The following assertion was thrown building Login(dirty, dependencies: [_InheritedTheme,
I/flutter ( 4421): _LocalizationsScope-[GlobalKey#5872b]], state: _LoginState#6fe41):
I/flutter ( 4421): setState() or markNeedsBuild() called during build.
I/flutter ( 4421): This Overlay widget cannot be marked as needing to build because the framework is already in the
I/flutter ( 4421): process of building widgets. A widget can be marked as needing to be built during the build phase
I/flutter ( 4421): only if one of its ancestors is currently building. This exception is allowed because the framework
I/flutter ( 4421): builds parent widgets before children, which means a dirty descendant will always be built.
I/flutter ( 4421): Otherwise, the framework might not visit this widget during this build phase.
I/flutter ( 4421): The widget on which setState() or markNeedsBuild() was called was:
I/flutter ( 4421): Overlay-[LabeledGlobalKey<OverlayState>#e1e0c]
I/flutter ( 4421): The widget which was currently being built when the offending call was made was:
I/flutter ( 4421): Login
I/flutter ( 4421):
I/flutter ( 4421): The relevant error-causing widget was:
I/flutter ( 4421): Login file:///D:/flutter_projects/project/lib/screens/login_reg.dart:50:23
I/flutter ( 4421):
I/flutter ( 4421): When the exception was thrown, this was the stack:
I/flutter ( 4421): #0 Element.markNeedsBuild.<anonymous closure> (package:flutter/src/widgets/framework.dart:3896:11)
I/flutter ( 4421): #1 Element.markNeedsBuild (package:flutter/src/widgets/framework.dart:3911:6)
I/flutter ( 4421): #2 State.setState (package:flutter/src/widgets/framework.dart:1168:14)
I/flutter ( 4421): #3 OverlayState.insertAll (package:flutter/src/widgets/overlay.dart:344:5)
I/flutter ( 4421): #4 OverlayRoute.install (package:flutter/src/widgets/routes.dart:44:24)
I/flutter ( 4421): #5 TransitionRoute.install (package:flutter/src/widgets/routes.dart:181:11)
I/flutter ( 4421): #6 ModalRoute.install (package:flutter/src/widgets/routes.dart:959:11)
I/flutter ( 4421): #7 NavigatorState.pushReplacement (package:flutter/src/widgets/navigator.dart:1883:14)
I/flutter ( 4421): #8 NavigatorState.pushReplacementNamed (package:flutter/src/widgets/navigator.dart:1710:12)
I/flutter ( 4421): #9 Navigator.pushReplacementNamed (package:flutter/src/widgets/navigator.dart:972:34)
I/flutter ( 4421): #10 _LoginState.loginPressed (package:project/screens/login.dart:72:15)
I/flutter ( 4421): #11 _LoginState.build (package:project/screens/login.dart:57:30)
I/flutter ( 4421): #12 StatefulElement.build (package:flutter/src/widgets/framework.dart:4334:27)
I/flutter ( 4421): #13 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4223:15)
I/flutter ( 4421): #14 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
I/flutter ( 4421): #15 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
I/flutter ( 4421): #16 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11)
I/flutter ( 4421): #17 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
I/flutter ( 4421): #18 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 4421): #19 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 4421): #20 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
I/flutter ( 4421): #21 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
I/flutter ( 4421): #22 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
I/flutter ( 4421): #23 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
I/flutter ( 4421): #24 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 4421): #25 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 4421): #26 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
I/flutter ( 4421): #27 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 4421): #28 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 4421): #29 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
I/flutter ( 4421): #30 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 4421): #31 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 4421): #32 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
I/flutter ( 4421): #33 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
I/flutter ( 4421): #34 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
I/flutter ( 4421): #35 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
I/flutter ( 4421): #36 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 4421): #37 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 4421): #38 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
I/flutter ( 4421): #39 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
I/flutter ( 4421): #40 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
I/flutter ( 4421): #41 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
I/flutter ( 4421): #42 ParentDataElement.mount (package:flutter/src/widgets/framework.dart:4617:11)
I/flutter ( 4421): #43 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 4421): #44 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 4421): #45 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
I/flutter ( 4421): #46 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
I/flutter ( 4421): #47 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
I/flutter ( 4421): #48 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11)
I/flutter ( 4421): #49 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
I/flutter ( 4421): #50 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 4421): #51 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 4421): #52 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
I/flutter ( 4421): #53 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
I/flutter ( 4421): #54 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
I/flutter ( 4421): #55 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
I/flutter ( 4421): #56 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 4421): #57 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 4421): #58 SliverMultiBoxAdaptorElement.updateChild (package:flutter/src/widgets/sliver.dart:1288:36)
I/flutter ( 4421): #59 SliverMultiBoxAdaptorElement.createChild.<anonymous closure> (package:flutter/src/widgets/sliver.dart:1273:20)
I/flutter ( 4421): #60 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2412:19)
I/flutter ( 4421): #61 SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1266:11)
I/flutter ( 4421): #62 RenderSliverMultiBoxAdaptor._createOrObtainChild.<anonymous closure> (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:354:23)
I/flutter ( 4421): #63 RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1823:58)
I/flutter ( 4421): #64 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:875:15)
I/flutter ( 4421): #65 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1823:13)
I/flutter ( 4421): #66 RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:343:5)
I/flutter ( 4421): #67 RenderSliverMultiBoxAdaptor.addInitialChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:427:5)
I/flutter ( 4421): #68 RenderSliverFixedExtentBoxAdaptor.performLayout (package:flutter/src/rendering/sliver_fixed_extent_list.dart:196:12)
I/flutter ( 4421): #69 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #70 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:134:11)
I/flutter ( 4421): #71 _RenderSliverFractionalPadding.performLayout (package:flutter/src/widgets/sliver.dart:1165:11)
I/flutter ( 4421): #72 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #73 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:410:13)
I/flutter ( 4421): #74 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1367:12)
I/flutter ( 4421): #75 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1285:20)
I/flutter ( 4421): #76 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #77 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #78 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #79 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #80 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #81 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #82 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #83 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #84 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #85 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #86 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #87 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #88 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #89 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #90 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #91 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #92 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #93 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #94 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #95 RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:806:17)
I/flutter ( 4421): #96 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #97 RenderPositionedBox.performLayout (package:flutter/src/rendering/shifted_box.dart:392:13)
I/flutter ( 4421): #98 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #99 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:163:11)
I/flutter ( 4421): #100 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:477:7)
I/flutter ( 4421): #101 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:232:7)
I/flutter ( 4421): #102 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:391:14)
I/flutter ( 4421): #103 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #104 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #105 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #106 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #107 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1232:11)
I/flutter ( 4421): #108 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #109 RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:206:11)
I/flutter ( 4421): #110 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #111 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #112 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #113 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #114 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #115 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #116 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #117 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #118 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #119 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #120 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #121 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #122 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #123 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #124 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #125 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3166:14)
I/flutter ( 4421): #126 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following NoSuchMethodError was thrown building _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#09487](dirty, state: _OverlayEntryState#46afb):
The getter 'status' was called on null.
Receiver: null
Tried calling: status
The relevant error-causing widget was:
MaterialApp file:///D:/flutter_projects/project/lib/main.dart:36:12
When the exception was thrown, this was the stack:
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
#1 ModalRoute._buildModalBarrier (package:flutter/src/widgets/routes.dart:1305:27)
#2 _OverlayEntryState.build (package:flutter/src/widgets/overlay.dart:169:25)
#3 StatefulElement.build (package:flutter/src/widgets/framework.dart:4334:27)
#4 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4223:15)
...
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The method 'drive' was called on null.
Receiver: null
Tried calling: drive<Offset>(Instance of '_ChainedEvaluation<Offset>')
The relevant error-causing widget was:
MaterialApp file:///D:/flutter_projects/project/lib/main.dart:36:12
════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter ( 4421): #127 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:505:15)
I/flutter ( 4421): #128 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1584:7)
I/flutter ( 4421): #129 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:844:18)
I/flutter ( 4421): #130 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:344:19)
I/flutter ( 4421): #131 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:774:13)
I/flutter ( 4421): #132 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:283:5)
I/flutter ( 4421): #133 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1102:15)
I/flutter ( 4421): #134 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1041:9)
I/flutter ( 4421): #135 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:957:5)
I/flutter ( 4421): #139 _invoke (dart:ui/hooks.dart:259:10)
I/flutter ( 4421): #140 _drawFrame (dart:ui/hooks.dart:217:3)
I/flutter ( 4421): (elided 3 frames from package dart:async)
I/flutter ( 4421):
I/flutter ( 4421): ════════════════════════════════════════════════════════════════════════════════════════════════════
Have no idea what has gone wrong.
In your widget building code, you are calling that loginPressed method.
Remember, when you write the following code:
loginPressed(context)
it's actually calling/executing that function. So, you are actually trying to navigate to another page while the current widget is still building. That's the reason why you are getting the exception.
You can fix it in 2 ways:
Method 1:
Change your onPressed code like:
onPressed: () {
loginPressed(context);
}
Method 2:
Pass the function reference (You don't need to pass the context, the function will already have access to that):
onPressed:loginPressed,
And change the function like:
loginPressed() {
Navigator.pushReplacementNamed(context, 'home');
}

Flutter Provider Weird Split Method Error When Navigating

So I am using the Provider Package in my Flutter app and everything is going well until I closed my project in VSCode and reopened it with the same exact code and then I try to navigate to a new page using this method :
void _goToTheSettingsPage(BuildContext context) {
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => ChangeNotifierProvider.value(
value: SettingsProvider(),
child: SettingsPage(),
),
),
);
}
and the SettingsPage is code is very simple :
class SettingsPage extends StatelessWidget {
#override
Widget build(BuildContext context) {
AppLocalizations appLocalizations = AppLocalizations.of(context);
BibleDatabase bibleDatabase = Provider.of<BibleDatabase>(context);
SettingsProvider settingsProvider = Provider.of<SettingsProvider>(context);
int selectedTool = Provider.of<int>(context);
Color selectedColor = HelperMethods.getColorFromNumber(selectedTool);
double screenWidth = MediaQuery.of(context).size.width;
return Scaffold(
// Normal UI Widgets Here
)
}
}
and those are the providers I have put in the start of the Material App :
[
StreamProvider<double>(
builder: (context) => bibleDatabase.preferredFontSizeController.stream,
),
StreamProvider<int>(
builder: (context) => bibleDatabase.selectedToolController.stream,
)
];
while bibleDatabase is just a value coming from a normal Provider.value() object...
so why I am getting this weird error??
I/flutter ( 8624): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 8624): The following NoSuchMethodError was thrown building SettingsPage(dirty, dependencies:
I/flutter ( 8624): [InheritedProvider<SettingsProvider>, _LocalizationsScope-[GlobalKey#d8deb], MediaQuery,
I/flutter ( 8624): InheritedProvider<BibleDatabase>, InheritedProvider<int>]):
I/flutter ( 8624): The method 'split' was called on null.
I/flutter ( 8624): Receiver: null
I/flutter ( 8624): Tried calling: split(".")
I/flutter ( 8624): User-created ancestor of the error-causing widget was:
I/flutter ( 8624): ChangeNotifierProvider<SettingsProvider>
I/flutter ( 8624):
lib\pages\bible_page.dart:75
I/flutter ( 8624): When the exception was thrown, this was the stack:
I/flutter ( 8624): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5)
I/flutter ( 8624): #1 AppLocalizations._resolve
package:easy_localization/easy_localization_delegate.dart:84
I/flutter ( 8624): #2 AppLocalizations.tr
package:easy_localization/easy_localization_delegate.dart:62
I/flutter ( 8624): #3 SettingsPage.build
package:christy/pages/settings_page.dart:48
I/flutter ( 8624): #4 StatelessElement.build
package:flutter/…/widgets/framework.dart:4001
I/flutter ( 8624): #5 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3933
I/flutter ( 8624): #6 Element.rebuild
package:flutter/…/widgets/framework.dart:3730
I/flutter ( 8624): #7 ComponentElement._firstBuild
package:flutter/…/widgets/framework.dart:3916
I/flutter ( 8624): #8 ComponentElement.mount
package:flutter/…/widgets/framework.dart:3911
I/flutter ( 8624): #9 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter ( 8624): #10 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #11 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3953
I/flutter ( 8624): #12 Element.rebuild
package:flutter/…/widgets/framework.dart:3730
I/flutter ( 8624): #13 ComponentElement._firstBuild
package:flutter/…/widgets/framework.dart:3916
I/flutter ( 8624): #14 ComponentElement.mount
package:flutter/…/widgets/framework.dart:3911
I/flutter ( 8624): #15 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter ( 8624): #16 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #17 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3953
I/flutter ( 8624): #18 Element.rebuild
package:flutter/…/widgets/framework.dart:3730
I/flutter ( 8624): #19 ComponentElement._firstBuild
package:flutter/…/widgets/framework.dart:3916
I/flutter ( 8624): #20 StatefulElement._firstBuild
package:flutter/…/widgets/framework.dart:4080
I/flutter ( 8624): #21 ComponentElement.mount
package:flutter/…/widgets/framework.dart:3911
I/flutter ( 8624): #22 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter ( 8624): #23 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #24 SingleChildRenderObjectElement.mount
package:flutter/…/widgets/framework.dart:5119
I/flutter ( 8624): #25 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter ( 8624): #26 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #27 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3953
I/flutter ( 8624): #28 Element.rebuild
package:flutter/…/widgets/framework.dart:3730
I/flutter ( 8624): #29 ComponentElement._firstBuild
package:flutter/…/widgets/framework.dart:3916
I/flutter ( 8624): #30 ComponentElement.mount
package:flutter/…/widgets/framework.dart:3911
I/flutter ( 8624): #31 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter ( 8624): #32 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #33 SingleChildRenderObjectElement.mount
package:flutter/…/widgets/framework.dart:5119
I/flutter ( 8624): #34 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter ( 8624): #35 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #36 SingleChildRenderObjectElement.mount
package:flutter/…/widgets/framework.dart:5119
I/flutter ( 8624): #37 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter ( 8624): #38 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #39 SingleChildRenderObjectElement.mount
package:flutter/…/widgets/framework.dart:5119
I/flutter ( 8624): #40 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter ( 8624): #41 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #42 SingleChildRenderObjectElement.mount
package:flutter/…/widgets/framework.dart:5119
I/flutter ( 8624): #43 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter ( 8624): #44 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #45 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3953
I/flutter ( 8624): #46 Element.rebuild
package:flutter/…/widgets/framework.dart:3730
I/flutter ( 8624): #47 ComponentElement._firstBuild
package:flutter/…/widgets/framework.dart:3916
I/flutter ( 8624): #48 StatefulElement._firstBuild
package:flutter/…/widgets/framework.dart:4080
I/flutter ( 8624): #49 ComponentElement.mount
package:flutter/…/widgets/framework.dart:3911
I/flutter ( 8624): #50 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter ( 8624): #51 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #52 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3953
I/flutter ( 8624): #53 Element.rebuild
package:flutter/…/widgets/framework.dart:3730
I/flutter ( 8624): #54 ComponentElement._firstBuild
package:flutter/…/widgets/framework.dart:3916
I/flutter ( 8624): #55 ComponentElement.mount
package:flutter/…/widgets/framework.dart:3911
I/flutter ( 8624): #56 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter ( 8624): #57 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #58 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3953
I/flutter ( 8624): #59 Element.rebuild
package:flutter/…/widgets/framework.dart:3730
I/flutter ( 8624): #60 ComponentElement._firstBuild
package:flutter/…/widgets/framework.dart:3916
I/flutter ( 8624): #68 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3953
I/flutter ( 8624): #69 Element.rebuild
package:flutter/…/widgets/framework.dart:3730
I/flutter ( 8624): #70 ComponentElement._firstBuild
package:flutter/…/widgets/framework.dart:3916
I/flutter ( 8624): #71 ComponentElement.mount
package:flutter/…/widgets/framework.dart:3911
I/flutter ( 8624): #72 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter ( 8624): #73 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #74 SingleChildRenderObjectElement.mount
package:flutter/…/widgets/framework.dart:5119
I/flutter ( 8624): #75 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter ( 8624): #76 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #77 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3953
I/flutter ( 8624): #78 Element.rebuild
package:flutter/…/widgets/framework.dart:3730
I/flutter ( 8624): #79 ComponentElement._firstBuild
package:flutter/…/widgets/framework.dart:3916
I/flutter ( 8624): #80 StatefulElement._firstBuild
package:flutter/…/widgets/framework.dart:4080
I/flutter ( 8624): #81 ComponentElement.mount
package:flutter/…/widgets/framework.dart:3911
I/flutter ( 8624): #82 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter ( 8624): #83 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #84 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3953
I/flutter ( 8624): #92 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #93 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3953
I/flutter ( 8624): #94 Element.rebuild
package:flutter/…/widgets/framework.dart:3730
I/flutter ( 8624): #95 ComponentElement._firstBuild
package:flutter/…/widgets/framework.dart:3916
I/flutter ( 8624): #96 ComponentElement.mount
package:flutter/…/widgets/framework.dart:3911
I/flutter ( 8624): #97 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter ( 8624): #98 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #99 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3953
I/flutter ( 8624): #100 Element.rebuild
package:flutter/…/widgets/framework.dart:3730
I/flutter ( 8624): #101 ComponentElement._firstBuild
package:flutter/…/widgets/framework.dart:3916
I/flutter ( 8624): #102 StatefulElement._firstBuild
package:flutter/…/widgets/framework.dart:4080
I/flutter ( 8624): #103 ComponentElement.mount
package:flutter/…/widgets/framework.dart:3911
I/flutter ( 8624): #104 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter ( 8624): #105 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #106 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3953
I/flutter ( 8624): #107 Element.rebuild
package:flutter/…/widgets/framework.dart:3730
I/flutter ( 8624): #108 ComponentElement._firstBuild
package:flutter/…/widgets/framework.dart:3916
I/flutter ( 8624): #109 StatefulElement._firstBuild
package:flutter/…/widgets/framework.dart:4080
I/flutter ( 8624): #110 ComponentElement.mount
package:flutter/…/widgets/framework.dart:3911
I/flutter ( 8624): #111 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3093
I/flutter ( 8624): #112 Element.updateChild
package:flutter/…/widgets/framework.dart:2896
I/flutter ( 8624): #113 RenderObjectElement.updateChildren
package:flutter/…/widgets/framework.dart:4902
I/flutter ( 8624): #114 MultiChildRenderObjectElement.update
package:flutter/…/widgets/framework.dart:5235
I/flutter ( 8624): #115 Element.updateChild
package:flutter/…/widgets/framework.dart:2885
I/flutter ( 8624): #116 _TheatreElement.update
package:flutter/…/widgets/overlay.dart:607
I/flutter ( 8624): #117 Element.updateChild
package:flutter/…/widgets/framework.dart:2885
I/flutter ( 8624): #118 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3953
I/flutter ( 8624): #119 Element.rebuild
package:flutter/…/widgets/framework.dart:3730
I/flutter ( 8624): #120 StatefulElement.update
package:flutter/…/widgets/framework.dart:4112
I/flutter ( 8624): #121 Element.updateChild
package:flutter/…/widgets/framework.dart:2885
I/flutter ( 8624): #122 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3953
I/flutter ( 8624): #123 Element.rebuild
package:flutter/…/widgets/framework.dart:3730
I/flutter ( 8624): #124 ProxyElement.update
package:flutter/…/widgets/framework.dart:4246
I/flutter ( 8624): #125 _InheritedNotifierElement.update
package:flutter/…/widgets/inherited_notifier.dart:94
I/flutter ( 8624): #126 Element.updateChild
package:flutter/…/widgets/framework.dart:2885
I/flutter ( 8624): #127 SingleChildRenderObjectElement.update
package:flutter/…/widgets/framework.dart:5126
I/flutter ( 8624): #128 Element.updateChild
package:flutter/…/widgets/framework.dart:2885
I/flutter ( 8624): #129 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3953
I/flutter ( 8624): #130 Element.rebuild
package:flutter/…/widgets/framework.dart:3730
I/flutter ( 8624): #131 StatefulElement.update
package:flutter/…/widgets/framework.dart:4112
I/flutter ( 8624): #132 Element.updateChild
package:flutter/…/widgets/framework.dart:2885
I/flutter ( 8624): #133 SingleChildRenderObjectElement.update
package:flutter/…/widgets/framework.dart:5126
I/flutter ( 8624): #134 Element.updateChild
package:flutter/…/widgets/framework.dart:2885
I/flutter ( 8624): #135 SingleChildRenderObjectElement.update
package:flutter/…/widgets/framework.dart:5126
I/flutter ( 8624): #136 Element.updateChild
package:flutter/…/widgets/framework.dart:2885
I/flutter ( 8624): #137 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:3953
I/flutter ( 8624): #138 Element.rebuild
package:flutter/…/widgets/framework.dart:3730
I/flutter ( 8624): #139 BuildOwner.buildScope
package:flutter/…/widgets/framework.dart:2340
I/flutter ( 8624): #140 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame
package:flutter/…/widgets/binding.dart:701
I/flutter ( 8624): #141 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback
package:flutter/…/rendering/binding.dart:285
I/flutter ( 8624): #142 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback
package:flutter/…/scheduler/binding.dart:1033
I/flutter ( 8624): #143 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame
package:flutter/…/scheduler/binding.dart:975
I/flutter ( 8624): #144 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame
package:flutter/…/scheduler/binding.dart:891
I/flutter ( 8624): #148 _invoke (dart:ui/hooks.dart:236:10)
I/flutter ( 8624): #149 _drawFrame (dart:ui/hooks.dart:194:3)
I/flutter ( 8624): (elided 3 frames from package dart:async)
I/flutter ( 8624): ════════════════════════════════════════════════════════════════════════════════════════════════════
I recently encountered this error. This error is because of Navigation. When you use Navigator.of(context).push then navigating page will become the child of the Material app and it will have no longer access to Provider.
See this Example::
Widget Tree before navigation
if you see this I am having MaterialApp and to that, I am children of Provider of AuthRouter. I wanted AuthRouter to be available to the entire Tree.
When I Navigate from StudentHomePage the widget tree will become like this
Widget Tree before navigation
If you see My AuthRouter is no Longer a Child of the MaterialApp. So StudentDashboardPage is a new child and it doesn't have access to AuthRouter. so when I try to access AuthRouter from StudentDashboardPage It will show an error.
Solution 1:: Pass the provider objects to SettingsPage i.e dependency injection.
I hope it will work for you.
Solution 2:: Wrap Provider on top of MaterialApp

NoSuchMethodError: The method 'drive' was called on null

I know there are quite a few questions that have a resembling title of NoSuchMethodError: The method '#**something**#' was called on null. And usually this issue happens when you try to access a null object's method. But, in my case this Exception is shown when I try to add the following code to my StatefulWidget:
_handleMyBusinessesTap() {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => PageBusinessList(
firebaseUser: widget.firebaseUser,
),
),
);
}
Once I try to use the Navigator object in my code I'm getting this exception.
The only difference I can think of that I have in this page from the other pages in which Navigator object does not causes any issues is that I build my page this way:
Widget build(BuildContext context) {
return DefaultTabController(
length: 3,
child: Scaffold(
appBar: _buildAppBar(),
drawer: _buildDrawer(),
body: _buildBody(),
),
);
}
I'm using here DefaultTabController contains a body of 3 page:
Widget _buildBody() {
return TabBarView(
children: [
MyCardScreen(),
ReceivedScreen(),
SentScreen(),
],
);
}
The _handleMyBusinessesTap method is one of the options I have in the drawer which I want to take me to a new page, but for some reason once I add it it throws this exception in the title. Does someone encountered this problem and know how it should be handled?
here is the buildDrawer method:
Widget _buildDrawer() {
return Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
UserAccountsDrawerHeader(
accountName: _buildAccountNameWidget(),
accountEmail: _buildAccountEmailWidget(),
currentAccountPicture: _buildAccountCircleAvatar(),
),
ListTile(title: Text("My Default Business Card"), onTap: _handleMyDefaultBusinessCardTap()),
ListTile(title: Text("My Businesses"), onTap: _handleMyBusinessesTap()),
ListTile(title: Text("Terms and Conditions"), onTap: _handleTermsAndConditionsTap()),
ListTile(title: Text("Privacy Policy"), onTap: _handlePrivacyPolicyTap()),
ListTile(title: Text("Log Out"), onTap: _handleLogOutTap()),
],
),
);
}
here is there rest of the stack:
I/flutter ( 722): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 722): The following assertion was thrown building PageMain(dirty, dependencies: [_InheritedTheme,
I/flutter ( 722): _LocalizationsScope-[GlobalKey#b039d]], state: _PageMainWidgetState#e33af):
I/flutter ( 722): setState() or markNeedsBuild() called during build.
I/flutter ( 722): This Overlay widget cannot be marked as needing to build because the framework is already in the
I/flutter ( 722): process of building widgets. A widget can be marked as needing to be built during the build phase
I/flutter ( 722): only if one of its ancestors is currently building. This exception is allowed because the framework
I/flutter ( 722): builds parent widgets before children, which means a dirty descendant will always be built.
I/flutter ( 722): Otherwise, the framework might not visit this widget during this build phase.
I/flutter ( 722): The widget on which setState() or markNeedsBuild() was called was:
I/flutter ( 722): Overlay-[LabeledGlobalKey<OverlayState>#51a6b](state: OverlayState#7d0ac(entries:
I/flutter ( 722): [OverlayEntry#f42cb(opaque: false; maintainState: false), OverlayEntry#d6b18(opaque: false;
I/flutter ( 722): maintainState: true), OverlayEntry#75d78(opaque: false; maintainState: false),
I/flutter ( 722): OverlayEntry#02406(opaque: false; maintainState: true), OverlayEntry#8f4e5(opaque: false;
I/flutter ( 722): maintainState: false), OverlayEntry#11c40(opaque: false; maintainState: true)]))
I/flutter ( 722): The widget which was currently being built when the offending call was made was:
I/flutter ( 722): PageMain(dirty, dependencies: [_InheritedTheme, _LocalizationsScope-[GlobalKey#b039d]], state:
I/flutter ( 722): _PageMainWidgetState#e33af)
I/flutter ( 722): When the exception was thrown, this was the stack:
I/flutter ( 722): #0 Element.markNeedsBuild.<anonymous closure> (package:flutter/src/widgets/framework.dart:3503:11)
I/flutter ( 722): #1 Element.markNeedsBuild (package:flutter/src/widgets/framework.dart:3529:6)
I/flutter ( 722): #2 State.setState (package:flutter/src/widgets/framework.dart:1133:14)
I/flutter ( 722): #3 OverlayState.insertAll (package:flutter/src/widgets/overlay.dart:346:5)
I/flutter ( 722): #4 OverlayRoute.install (package:flutter/src/widgets/routes.dart:43:24)
I/flutter ( 722): #5 TransitionRoute.install (package:flutter/src/widgets/routes.dart:180:11)
I/flutter ( 722): #6 ModalRoute.install (package:flutter/src/widgets/routes.dart:895:11)
I/flutter ( 722): #7 NavigatorState.push (package:flutter/src/widgets/navigator.dart:1742:11)
I/flutter ( 722): #8 _PageMainWidgetState._handleMyBusinessesTap (package:bizooc_client/pages/page_main.dart:86:27)
I/flutter ( 722): #9 _PageMainWidgetState._buildDrawer (package:bizooc_client/pages/page_main.dart:60:57)
I/flutter ( 722): #10 _PageMainWidgetState.build (package:bizooc_client/pages/page_main.dart:33:17)
I/flutter ( 722): #11 StatefulElement.build (package:flutter/src/widgets/framework.dart:3825:27)
I/flutter ( 722): #12 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3739:15)
I/flutter ( 722): #13 Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter ( 722): #14 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter ( 722): #15 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter ( 722): #16 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter ( 722): #17 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #18 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #19 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter ( 722): #20 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #21 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #22 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter ( 722): #23 Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter ( 722): #24 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter ( 722): #25 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter ( 722): #26 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #27 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #28 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter ( 722): #29 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #30 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #31 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter ( 722): #32 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #33 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #34 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter ( 722): #35 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #36 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #37 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter ( 722): #38 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #39 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #40 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter ( 722): #41 Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter ( 722): #42 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter ( 722): #43 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter ( 722): #44 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter ( 722): #45 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #46 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #47 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter ( 722): #48 Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter ( 722): #49 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter ( 722): #50 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter ( 722): #51 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #52 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #53 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter ( 722): #54 Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter ( 722): #55 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter ( 722): #56 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter ( 722): #57 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter ( 722): #58 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #59 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #60 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter ( 722): #61 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #62 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #63 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter ( 722): #64 Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter ( 722): #65 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter ( 722): #66 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter ( 722): #67 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #68 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #69 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter ( 722): #70 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #71 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #72 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter ( 722): #73 Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter ( 722): #74 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter ( 722): #75 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter ( 722): #76 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter ( 722): #77 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #78 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #79 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter ( 722): #80 Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter ( 722): #81 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter ( 722): #82 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter ( 722): #83 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #84 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #85 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4876:14)
I/flutter ( 722): #86 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #87 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #88 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter ( 722): #89 Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter ( 722): #90 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter ( 722): #91 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter ( 722): #92 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #93 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #94 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter ( 722): #95 Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter ( 722): #96 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter ( 722): #97 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter ( 722): #98 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter ( 722): #99 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #100 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #101 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter ( 722): #102 Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter ( 722): #103 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3722:5)
I/flutter ( 722): #104 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3864:11)
I/flutter ( 722): #105 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3717:5)
I/flutter ( 722): #106 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2961:14)
I/flutter ( 722): #107 Element.updateChild (package:flutter/src/widgets/framework.dart:2764:12)
I/flutter ( 722): #108 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:4659:32)
I/flutter ( 722): #109 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4992:17)
I/flutter ( 722): #110 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter ( 722): #111 _TheatreElement.update (package:flutter/src/widgets/overlay.dart:607:16)
I/flutter ( 722): #112 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter ( 722): #113 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter ( 722): #114 Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter ( 722): #115 StatefulElement.update (package:flutter/src/widgets/framework.dart:3894:5)
I/flutter ( 722): #116 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter ( 722): #117 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter ( 722): #118 Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter ( 722): #119 ProxyElement.update (package:flutter/src/widgets/framework.dart:4006:5)
I/flutter ( 722): #120 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter ( 722): #121 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4883:14)
I/flutter ( 722): #122 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter ( 722): #123 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter ( 722): #124 Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter ( 722): #125 StatefulElement.update (package:flutter/src/widgets/framework.dart:3894:5)
I/flutter ( 722): #126 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter ( 722): #127 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4883:14)
I/flutter ( 722): #128 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter ( 722): #129 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4883:14)
I/flutter ( 722): #130 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:15)
I/flutter ( 722): #131 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3750:16)
I/flutter ( 722): #132 Element.rebuild (package:flutter/src/widgets/framework.dart:3565:5)
I/flutter ( 722): #133 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2278:33)
I/flutter ( 722): #134 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:700:20)
I/flutter ( 722): #135 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:286:5)
I/flutter ( 722): #136 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1012:15)
I/flutter ( 722): #137 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:952:9)
I/flutter ( 722): #138 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:864:5)
I/flutter ( 722): #142 _invoke (dart:ui/hooks.dart:219:10)
I/flutter ( 722): #143 _drawFrame (dart:ui/hooks.dart:178:3)
I/flutter ( 722): (elided 3 frames from package dart:async)
I/flutter ( 722): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter ( 722): Another exception was thrown: NoSuchMethodError: The getter 'status' was called on null.
I/flutter ( 722): Another exception was thrown: NoSuchMethodError: The method 'drive' was called on null.
This is a common error when use callbacks functions.
ListTile(title: Text("Log Out"), onTap: _handleLogOutTap()),
To fix your issue you have some options :
1-
ListTile(title: Text("Log Out"), onTap: _handleLogOutTap),
2-
ListTile(title: Text("Log Out"), onTap: () => _handleLogOutTap()),
3-
ListTile(title: Text("Log Out"), onTap: () { _handleLogOutTap() ; }),
The same for all of your ListTile's.