registerWithEmailPasswordName static method

Future<bool> registerWithEmailPasswordName(
  1. String email,
  2. String password,
  3. String name,
  4. AuthenticationProvider authProvider,
)

registration with email, password and name

Implementation

static Future<bool> registerWithEmailPasswordName(String email, String password, String name, AuthenticationProvider authProvider) async {
  bool isRegistrationSuccessful = false;
  try {
    final userCredentials = await FirebaseAuth.instance.createUserWithEmailAndPassword(email: email, password: password);
    if(userCredentials.user != null){
      userCredentials.user!.updateDisplayName(name);
      isRegistrationSuccessful = 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 isRegistrationSuccessful;
}