signupMail method

Future<User?> signupMail(
  1. String email,
  2. String password
)

Registers a new user with an email and password.

On successful registration, returns the User object for the registered user. Prints any errors encountered during the sign-up process.

Implementation

Future<User?> signupMail(String email, String password) async {
  try {
    UserCredential userCredential = await FirebaseAuth.instance
        .createUserWithEmailAndPassword(email: email, password: password);
    return userCredential.user;
  } on FirebaseAuthException catch (e) {
    print(e);
  }
  return null;
}