doesAccountExistWithThis static method

Future<bool> doesAccountExistWithThis(
  1. String email,
  2. AuthenticationProvider authProvider
)

checks whether any account exist with the provided email

Implementation

static Future<bool> doesAccountExistWithThis(String email, AuthenticationProvider authProvider)async{
  bool isAccountExists = false;
  try{
    final signInMethods = await FirebaseAuth.instance.fetchSignInMethodsForEmail(email);
    if(signInMethods.isNotEmpty){
      isAccountExists =  true;
    }
  }on FirebaseAuthException catch(e){
    authProvider.authExceptionType = AuthExceptions.typeOf[e.code];
  }catch (e) {
    printToConsole("Exception in FirebaseManageUsers.loginWithEmailPassword: ${e.toString()}");
    authProvider.authExceptionType = AuthExceptionType.unknown;
  }
  return isAccountExists;
}