Error: Unhandled Exception: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 2845 pos 18: '!navigator._debugLocked': is not true [closed] - flutter

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 12 months ago.
The community reviewed whether to reopen this question 2 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
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."

One of the way to solve this error is
Setting (Route<dynamic> route) => false will make sure that all routes before the pushed route are removed. This removes all routes in the stack so that user cannot go back to the previous routes after they have logged out.
if this does not work than you are on obsolete version of the framework. Current stable is 2.10.1. I recommend you to upgrade to latest which should resolve your issue.

Replace Navigator.pop(context) with Navigator.of(context).pop(context)
And Restart your application.

Related

Failed to load dynamic library 'libiris_event_handler.so': dlopen failed: library "libiris_event_handler.so" not found in Agora.io's newest SDK(6.0.0)

So, I just updated my Flutter App to run in the SDK 6.0.0, but for some reason, whenever I start the app in the emulator, I get this error message:
E/flutter (15665): [ERROR:flutter/runtime/dart_isolate.cc(1111)] Unhandled exception:
E/flutter (15665): Invalid argument(s): Failed to load dynamic library 'libiris_event_handler.so': dlopen failed: library "libiris_event_handler.so" not found
E/flutter (15665): #0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:12:43)
E/flutter (15665): #1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:23:12)
E/flutter (15665): #2 IrisEvent._loadAgoraRtcWrapperLib
package:iris_event/iris_event.dart:23
E/flutter (15665): #3 new IrisEvent
package:iris_event/iris_event.dart:15
E/flutter (15665): #4 _ApiCallExecutorInternal.initilize
package:agora_rtc_engine/…/impl/api_caller.dart:429
E/flutter (15665): #5 _ApiCallExecutor._execute
package:agora_rtc_engine/…/impl/api_caller.dart:183
E/flutter (15665): #6 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:300:17)
E/flutter (15665): #7 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
And yeah, I have no idea of what's going on. I even installed this library, the iris_event, but still, same error

I get an error while I send the following http get request. I use flutter 2.5

Here is the line of code the causes the error
var currencyData = await http.get(Uri.parse('https://rest.coinapi.io/v1/exchangerate/BTC/USD?apikey=------------------------'));
Here is the error log
E/flutter (20209): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: HandshakeException: Handshake error in client (OS Error:
E/flutter (20209): CERTIFICATE_VERIFY_FAILED: certificate has expired(handshake.cc:359))
E/flutter (20209): #0 _SecureFilterImpl._handshake (dart:io-patch/secure_socket_patch.dart:101:69)
E/flutter (20209): #1 _SecureFilterImpl.handshake (dart:io-patch/secure_socket_patch.dart:143:25)
E/flutter (20209): #2 _RawSecureSocket._secureHandshake (dart:io/secure_socket.dart:794:54)
E/flutter (20209): #3 _RawSecureSocket._tryFilter (dart:io/secure_socket.dart:924:19)
E/flutter (20209): <asynchronous suspension>
E/flutter (20209):
D/mali_winsys(20209): new_window_surface returns 0x3000, [720x1280]-format:1
D/libEGL (20209): eglInitialize EGLDisplay = 0xd867f7c4
I/OpenGLRenderer(20209): Initialized EGL, version 1.4
D/mali_winsys(20209): new_window_surface returns 0x3000, [720x1280]-format:1
I/Timeline(20209): Timeline: Activity_idle id: android.os.BinderProxy#a6bd033 time:158054628
E/flutter (20209): [ERROR:flutter/shell/common/shell.cc(93)] Dart Unhandled Exception: HandshakeException: Handshake error in client (OS Error:
E/flutter (20209): CERTIFICATE_VERIFY_FAILED: certificate has expired(handshake.cc:359)), stack trace: #0 _SecureFilterImpl._handshake (dart:io-patch/secure_socket_patch.dart:101:69)
E/flutter (20209): #1 _SecureFilterImpl.handshake (dart:io-patch/secure_socket_patch.dart:143:25)
E/flutter (20209): #2 _RawSecureSocket._secureHandshake (dart:io/secure_socket.dart:794:54)
E/flutter (20209): #3 _RawSecureSocket._tryFilter (dart:io/secure_socket.dart:924:19)
E/flutter (20209): <asynchronous suspension>
E/flutter (20209):
This is a https protocol issue. Since the url is working fine, is more like that there is a problem with your device. Trying adjust its clock may fix this problem because https needs both, client and sever, to have the same current time.
If this problem persists, try to run your code in a different device.

Periodic Error in Flutter: Unhandled Exception: Null check operator used on a null value

As soon as I start my App (it happens both in debug and profile mode), the following error occurs:
[ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Null check operator used on a null value
E/flutter (12391): #0 State.setState (package:flutter/src/widgets/framework.dart:1108)
E/flutter (12391): #1 _PollCardViewState.updatePoll.<anonymous closure> (package:mobile_app/components/poll_card_view/poll_card_view.dart:58)
E/flutter (12391): #2 _rootRunUnary (dart:async/zone.dart:1362)
E/flutter (12391): #3 _CustomZone.runUnary (dart:async/zone.dart:1265)
E/flutter (12391): #4 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170)
E/flutter (12391): #5 _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1207)
E/flutter (12391): #6 _rootRunUnary (dart:async/zone.dart:1370)
E/flutter (12391): #7 _CustomZone.runUnary (dart:async/zone.dart:1265)
E/flutter (12391): #8 _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1191)
E/flutter (12391): #9 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395)
E/flutter (12391): #10 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426)
E/flutter (12391): #11 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184)
E/flutter (12391):
The error happens periodically in the background and does not affect the app. In fact, the app seems to work just as always.
The error does not mention any of my widgets or different pages. I do not have any clue where this Null check operator is used on a null value.
Yesterday my app was just fine and this error did not happen.
I am not using Flutter Null Safety. But i did not use it from the beginning, and this error never happened before. Does anyone have an idea where the problem is?

Flutter - Error when trying to Sign In with Google and FIrebase

So I'm getting this error when trying to sign in with Google with Firebase.
E/flutter ( 2822): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null)
E/flutter ( 2822): #0 StandardMethodCodec.decodeEnvelope
package:flutter/…/services/message_codecs.dart:597
E/flutter ( 2822): #1 MethodChannel._invokeMethod
package:flutter/…/services/platform_channel.dart:158
E/flutter ( 2822): <asynchronous suspension>
E/flutter ( 2822): #2 MethodChannel.invokeMapMethod
package:flutter/…/services/platform_channel.dart:358
E/flutter ( 2822): <asynchronous suspension>
E/flutter ( 2822): #3 GoogleSignIn._callMethod
package:google_sign_in/google_sign_in.dart:235
E/flutter ( 2822): <asynchronous suspension>
E/flutter ( 2822): #4 GoogleSignIn.signIn.isCanceled (package:google_sign_in/google_sign_in.dart)
package:google_sign_in/google_sign_in.dart:1
E/flutter ( 2822): <asynchronous suspension>
E/flutter ( 2822):
I have followed all the steps (I believe) in integrating the app with Firebase, so does anyone know if this is a common error, and how would I go around fixing it?
If someone needs the code, I can provide it, but it is pretty much boilerplate Google Sign In code.
When I click the sign in button, it lets me choose Google account, but then it goes into infinite loading and throws this error in console.
[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null) apiException:10 means it's most likely due to incorrect setup of SHA-1 or SHA-256. Since you said that it works at the office, but when you change the device it was not work so make Update SHA-1 or SHA-256 in firebase same as your current device SHA key.

Purchase fails Flutter flutter_inapp_purchase

I have a non-renewing subscription in iOS that fails during testing. I'm using the Flutter library flutter_inapp_purchase. I am getting the products to successfully load/fetch from iTunesConnect, but I get an error when attempting to purchase. This error occurs after I successfully enter my Sandbox user credentials.
I've tested this sandbox user and IAP setup using a previous version of the app built in Swift and everything works as expected, so I'm fairly certain the issue is something specific to this Flutter.
Purchase Started !!
2019-05-08 11:44:47.819382-0500 Runner[16255:3743382]
Purchase Failed !!
2019-05-08 11:44:47.824961-0500 Runner[16255:3743449] flutter: Caused err. Set additionalSuccessPurchaseListenerIOS.
2019-05-08 11:44:47.825483-0500 Runner[16255:3743449] flutter: PlatformException(E_UNKNOWN, An unknown or unexpected error has occured. Please try again later., null)
2019-05-08 11:44:47.829865-0500 Runner[16255:3743449] [VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: PlatformException(ios, platform not supported, null)
#0 FlutterInappPurchase.buyProduct (package:flutter_inapp_purchase/flutter_inapp_purchase.dart:269:5)
<asynchronous suspension>
#1 _PurchaseSubscriptionPageState.buyProduct (package:undaunted_golf_flutter/PurchaseSubscriptionPage.dart:98:58)
<asynchronous suspension>
#2 _PurchaseSubscriptionPageState.build.<anonymous closure> (package:undaunted_golf_flutter/PurchaseSubscriptionPage.dart:344:25)
<asynchronous suspension>
#3 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:511:14)
#4 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:566:30)
#5 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:166:24)
#6 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:240:9)
#7 TapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:211:7)
#8 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
#9 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:225:20)
#10 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:199:22)
#11 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
#12 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
#13 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
#14 _rootRunUnary (dart:async/zone.dart:1136:13)
#15 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#16 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
#17 _invoke1 (dart:ui/hooks.dart:233:10)
#18 _dispatchPointerDataPacket (dart:ui/hooks.dart:154:5)
2019-05-08 11:45:22.597897-0500 Runner[16255:3743779] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C4.1:2][0x10ab13540] get output frames failed, state 8196
2019-05-08 11:45:22.598180-0500 Runner[16255:3743779] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C4.1:2][0x10ab13540] get output frames failed, state 8196
2019-05-08 11:45:22.598613-0500 Runner[16255:3743779] TIC Read Status [4:0x0]: 1:57
2019-05-08 11:45:22.598659-0500 Runner[16255:3743779] TIC Read Status [4:0x0]: 1:57
Solved!
1) I decided to use the Package created by the Google Flutter team. https://pub.dev/packages/in_app_purchase
2) This spit out a more helpful error. I discovered that the issue was with the build number in my XCode runner project.
To fix: Document Outline - Runner
Make sure General Tab is selected
Targets - Runner
Replace Build number with a numerical value rather than $(FLUTTER....)