Flutter unable to catch PlatformException while attempting firebase auth with googleSingIn

2,512

I have also recently faced this error and, I have found out that the .catchError() callback wasn't being called in the debug mode (which is when you click the Run->Start Debugging button in VSCode).

However, when you type in flutter run -d , then, the .catchError() method gets called back as it is not in debug mode.

To get your preferred simulator's code paste this line of code in the terminal:

instruments -s devices

If that doesn't work, you can also try pasting this:

xcrun simctl list

The .catchError() method will get called unlike before and the code inside that will get executed as expected!

Additionally, the app won't crash anymore with a PlatformException() and instead you will get a log like this one:

[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The getter 'uid' was called on null.
Receiver: null

I have been facing this problem in Google Sign In too, in which the .catchError() was not being called!

In conclusion, if you have some error with handling errors in Firebase Authentication, you should first try to first run in through the terminal. Thanks, and I hope this helps!

Share:
2,512
Mouad_el
Author by

Mouad_el

Updated on December 06, 2022

Comments

  • Mouad_el
    Mouad_el over 1 year

    I have just started using flutter, I am trying to implement firebase signing in using googleAuth and it shows these errors below:

    enter image description here