I face a problem about Unhandled Exception: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 2845 pos 18: '!navigator._debugLocked': is not true.
This is my Debug Console:
E/flutter ( 5236): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 2845 pos 18: '!navigator._debugLocked': is not true.
package:flutter/…/widgets/navigator.dart:2845
E/flutter ( 5236): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
E/flutter ( 5236): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
E/flutter ( 5236): #2 _RouteEntry.handlePush.<anonymous closure>
package:flutter/…/widgets/navigator.dart:2845
E/flutter ( 5236): #3 TickerFuture.whenCompleteOrCancel.thunk
package:flutter/…/scheduler/ticker.dart:407
E/flutter ( 5236): #4 _rootRunUnary (dart:async/zone.dart:1434:47)
E/flutter ( 5236): #5 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter ( 5236): <asynchronous suspension>
E/flutter ( 5236): #6 TickerFuture.whenCompleteOrCancel.thunk
package:flutter/…/scheduler/ticker.dart:406
E/flutter ( 5236): <asynchronous suspension>
E/flutter ( 5236):
Here is some code:
Navigator.pop(context);
How can I fix this?
I think this should solve.
WidgetsBinding.instance!.addPostFrameCallback((_) {
Navigator.pushReplacement(context, MaterialPageRoute(builder: (_) => MyPage()));
});
extracted from Error thrown on navigator pop until : "!_debugLocked': is not true."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With