register method

Future<void> register (
  1. String email,
  2. String password,
  3. String passwordConfirmation
)

Implementation

Future<void> register(
    String email, String password, String passwordConfirmation) async {
  if (!AuthValidations.isRegisterEmailFilled(email)) {
    AuthException.throwException(
        AuthExceptionErrors.INTERNAL_ERROR_BLANK_EMAIL);
  }

  if (!AuthValidations.isRegisterPasswordFilled(password)) {
    AuthException.throwException(
        AuthExceptionErrors.INTERNAL_ERROR_BLANK_PASSWORD);
  }

  if (!AuthValidations.isPasswordEqualConfirmation(
      password, passwordConfirmation)) {
    AuthException.throwException(
        AuthExceptionErrors.INTERNAL_ERROR_PASSWORD_CONFIRMATION);
  }

  return await _authRepository.register(email, password).catchError((error) {
    AuthException.throwException(error.toString());
  });
}