emailExists method

Future<bool> emailExists(
  1. String email
)

Returns true when email has a user registered

Implementation

Future<bool> emailExists(String email) async {
  try {
    final signInMethods =
        await firebaseAuth.fetchSignInMethodsForEmail(email);

    return signInMethods.length > 0;
  } on FirebaseAuthException catch (e) {
    return e.code.toLowerCase() == 'invalid-email';
  }
}