createUserWithEmailAndPassword method

Future<AuthUserCredentialVO> createUserWithEmailAndPassword({
  1. required String email,
  2. required String password,
  3. String? displayName,
})

Creates a new user with the provided email and password, and returns an AuthUserCredentialVO object.

Implementation

Future<AuthUserCredentialVO> createUserWithEmailAndPassword({
  required String email,
  required String password,
  String? displayName,
}) async {
  try {
    final authCredential = await _authDataService
        .createUserWithEmailAndPassword(email: email, password: password);
    final vo = AuthUserCredentialVO.fromAuthUserCredential(authCredential);
    _authStateController.add(currentUser);
    return vo;
  } catch (e) {
    if (e is RdevException) {
      throw AuthServiceException(
        code: e.code,
        message: e.message,
        stackTrace: e.stackTrace,
      );
    }
    throw AuthServiceException(
      stackTrace: StackTrace.current,
      message: e.toString(),
    );
  }
}