I need to catch and handle errors on my app when an user tries to sing in but I can’t achieve that.
How can I solve it?
Here is my code
@override
Future<void> signInUser(UserEntity user) async {
try {
if (user.email!.isNotEmpty && user.password!.isNotEmpty) {
await firebaseAuth.signInWithEmailAndPassword(
email: user.email!, password: user.password!);
}
} on PlatformException catch (e) {
if (e.code == "ERROR_USER_NOT_FOUND") {
showToast("user not found");
} else if (e.code == "INVALID_PASSWORD") {
showToast("Invalid email or password");
} else if (e.code == "ERROR_INVALID_EMAIL") {
showToast("Invalid email");
}
}
}
2
Answers
I have solved this problem by disabling breakpoint all exceptions and change tho code to: