1

I am using sign up with email in my Flutter app and using Firebase Authentication for the same. How do I show on the sign up page whether the entered email and username already exist in the database?

ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56
Laksh22
  • 197
  • 1
  • 4
  • 9

1 Answers1

3

firebase will return that info as an error message:

FirebaseAuth.instance.createUserWithEmailAndPassword(email: _email, password: _password).then((user) {

    // do whatever you want to do with new user object

  }).catchError((e) {
    print(e.details); // code, message, details
  });

if the email exists it'll trigger the catchError. it's worth noting that 'details' is the human readable error getter. 'code' and 'message' are useless to an end user, but those are the only two documented on firebase_auth.

blaneyneil
  • 3,122
  • 13
  • 14