signUp method

Future<String> signUp({
  1. required String email,
  2. required String password,
})

Creates a new user with the provided email and password.

Throws a SignUpWithEmailAndPasswordFailure if an exception occurs.

Implementation

Future<String> signUp({
  required String email,
  required String password,
}) async {
  try {
    final credentials = await _firebaseAuth.createUserWithEmailAndPassword(
      email: email,
      password: password,
    );

    return credentials.user!.uid;
  } on FirebaseAuthException catch (e) {
    throw SignUpWithEmailAndPasswordFailure.fromCode(e.code);
  } catch (_) {
    throw const SignUpWithEmailAndPasswordFailure();
  }
}