createUserWithEmailAndPassword method Null safety

Future<UserCredential> createUserWithEmailAndPassword(
  1. {required String email,
  2. required String password}

Tries to create a new user account with the given email address and password.

A FirebaseAuthException maybe thrown with the following error code:

  • email-already-in-use:
  • Thrown if there already exists an account with the given email address.
  • invalid-email:
  • Thrown if the email address is not valid.
  • operation-not-allowed:
  • Thrown if email/password accounts are not enabled. Enable email/password accounts in the Firebase Console, under the Auth tab.
  • weak-password:
  • Thrown if the password is not strong enough.


Future<UserCredential> createUserWithEmailAndPassword({
  required String email,
  required String password,
}) async {
  return UserCredential._(
    await _delegate.createUserWithEmailAndPassword(email, password),