signInWithMailPass method

Future<AuthResponse> signInWithMailPass(
  1. String mail,
  2. String pass
)

Implementation

Future<AuthResponse> signInWithMailPass(String mail, String pass) async {
  FirebaseAuthException? errorEx;

  UserCredential userCredential = await FirebaseAuth.instance
      .signInWithEmailAndPassword(email: mail, password: pass)
      .catchError((error) {
    errorEx = error;
    print(getMessageFromErrorCode(errorEx!.code) +
        ":" +
        error.toString() +
        ":" +
        error.code);
  });
  if (errorEx != null) {
    return AuthResponse(Status.Failed, errorEx!.message, errorEx!.code);
  }
  user = userCredential.user;
  notifyListeners();
  if (user != null) {
    print(" logged in with mail pass ");
  }

  _credential = EmailAuthProvider.credential(email: mail, password: pass);

  return AuthResponse(Status.Successed, "Successed.");
}