Issue
I am getting
Exception has occurred. PlatformException (PlatformException(sign_in_canceled, com.google.android.gms.common.api.ApiException: 12501: , null))
whenever I try to cancel login with google pop up in my app.
STEP TO REPRODUCE:
In the app when pressed login with google button the google sign in page appears with all the gmail accounts to choose from to login or signup.
Touch the outer area of the pop up to cancel the sign in , which then shuts down the pop up.
After that there is platform exception in the code saying :
Exception has occurred. PlatformException (PlatformException(sign_in_canceled, com.google.android.gms.common.api.ApiException: 12501: , null))
Now the login button is not working and the app crashes,
Tried try/catch - not working
Solution
try {
final res = await _auth.signInWithEmailAndPassword(
email: email, password: password);
if (res != null) loggedUser = res.user;
} on PlatformException catch (err) {
// Handle err
} catch (err) {
// other types of Exceptions
}
Answered By - Oscarreño
Answer Checked By - Mary Flores (JavaFixing Volunteer)