Please does anyone know how to catch firebase Auth exceptions on flutter and display them?
Note: I am not interested in the console (catcherror((e) print(e))
I need something that is more effective, e.g " user doesn't exist" So that I can then pass it to a string and display it.
Been dealing with this for months.
Thanks in advance.
I have tried replacing print(e) with // errorMessage=e.toString(); and then passing it to a function, all efforts have been futile.
FirebaseAuth.instance
.signInWithEmailAndPassword(email: emailController.text, password: passwordController.text)
.then((FirebaseUser user) {
_isInAsyncCall=false;
Navigator.of(context).pushReplacementNamed("/TheNextPage");
}).catchError((e) {
// errorMessage=e.toString();
print(e);
_showDialog(errorMessage);
//exceptionNotice();
//print(e);
I want to be able to extract the exception message and pass the exception message to a dialog that I can then display to the user.