createUserByEmail method

dynamic createUserByEmail({
  1. required String emailId,
  2. required String password,
})

Login with Email

Implementation

createUserByEmail({required String emailId, required String password}) async {
  try {
    final credential =
        await FirebaseAuth.instance.createUserWithEmailAndPassword(
      email: emailId,
      password: password,
    );
    return credential;
  } on FirebaseAuthException catch (e) {
    if (e.code == 'weak-password') {
      return 'The password provided is too weak.';
      // print('The password provided is too weak.');
    } else if (e.code == 'email-already-in-use') {
      return 'The account already exists for that email.';
      // print('The account already exists for that email.');
    }
  } catch (e) {
    return e.toString();
  }
  return '';
}