Ad
Catching Errors In Flutter / Firebase Auth Sign Up
I'm having a bit of trouble catching errors from firebase authentication instances in flutter , I don't know what is wrong the code still throws exceptions even though i'm catching the errors , In addition , I have no idea how to identify the exception type whether its a badly formatted email , email already in use , weak password , etc.... and there is no proper documentation for such thing
I have tried this:
FirebaseAuth.instance.createUserWithEmailAndPassword(
email: _email, password: _password)
.then((currentUser) => {
//Execute
}).catchError((onError)=>{
print(onError)
});
And tried a simple try-catch block and none of them catch the exception
Ad
Answer
FirebaseAuth.instance.createUserWithEmailAndPassword(
email: _email, password: _password)
.then((currentUser) => {
//Execute
}).catchError((onError)=>{
//Handle error i.e display notification or toast
});
This code actually works but the editor (Visual Studio code) itself is throwing exceptions and crashing the app , if you run the app from the device or emulator itself the issue will be solved
Ad
source: stackoverflow.com
Related Questions
- → How can I query Firebase for an equalTo boolean parameter?
- → How can I access nested data in Firebase with React?
- → Firebase simple blog (confused with security rules)
- → Removing item in Firebase with React, re-render returns item undefined
- → AngularJS Unknown Provider Error (Firebase & AngularFire)
- → How do you pass top level component state down to Routes using react-router?
- → "this" is null in firebase query function in reactjs
- → Angular Module Failed to Load
- → Multiple dex files define Lcom/google/android/gms/internal/zzrx;
- → Joining Firebase tables in React
- → How can I make add firepad to my reactjs project?
- → How to use Cloud Functions for Firebase to prerender pages for SEO?
- → React.js component has null state?
Ad