I'm using firebase_auth for phone number verification. Here's the minimal code.
Future<void> foo() async {
await FirebaseAuth.instance.verifyPhoneNumber(
verificationFailed: (_) {
throw Exception('Foo'); // It throws an exception.
},
phoneNumber: '+1650',
verificationCompleted: (_) {},
codeSent: (_, __) {},
codeAutoRetrievalTimeout: (_) {},
);
}
I'm calling above function like this
void main() {
foo().catchError(print); // But this code fails to catch it.
}
But catchError doesn't seem to catch the error and I run into:
[VERBOSE-2:shell.cc(93)] Dart Unhandled Exception: Exception: foo
So, how do I properly catch that exception?