I am using Firebase Auth for my app and for login and to handle errors I wrote it in a try-catch block, but when I enter an incorrect password the app just crashes and throws "PlatformException (PlatformException(ERROR_WRONG_PASSWORD, The password is invalid or the user does not have a password., null))" this error.
How can I fix this?
Here is the code, and the same is for registering users.
try {
final newUser = await _auth.signInWithEmailAndPassword(email: email, password: password);
if (newUser != null) {
Navigator.pop(context);
}
} catch (e) {
print(e);
}