When I click on the "google sign in" button and then instead of continuing I click on "cancel", this error comes out: "PlatformException (PlatformException (sign_in_canceled, com.google.GIDSignIn, The user canceled the sign-in flow., Null))."
The code is this:
Future<UserCredential?> signInWithGoogle() async {
try {
// Trigger the authentication flow
final GoogleSignInAccount? utenteGoogle = await GoogleSignIn().signIn();
// Obtain the auth details from the request
final GoogleSignInAuthentication? datiUtenteGoogle =
await utenteGoogle?.authentication;
// Create a new credential
final credenzialiGoogle = GoogleAuthProvider.credential(
accessToken: datiUtenteGoogle?.accessToken,
idToken: datiUtenteGoogle?.idToken,
);
// Once signed in, return the UserCredential
return await FirebaseAuth.instance.signInWithCredential(credenzialiGoogle);
} catch (e) {
print(e);
return null;
}
}
I tried to catch the error but nothing