signInWithEmailAndPassword static method

Future<User?> signInWithEmailAndPassword(
  1. BuildContext context, {
  2. required String email,
  3. required String password,
  4. dynamic onError(
    1. String
    )?,
  5. Function? onIncorrectCredentials,
  6. dynamic onSignInSuccessful(
    1. User?
    )?,
})

Initates a Mail & Password SignIn and the AuthManager changes the screen to the destinationFragment

Please enable Email and Password Authentication in your Firebase Authentication Console for this to work

context is necessary

email is required and is self-explanatory

password is also required and is self-explanatory

onError is a callback to handle any errors during the process

onIncorrectCredentials is a callback to handle incorrect credentials

onSignInSuccessful a Callback to perform any action after a successful SignIn

Implementation

static Future<User?> signInWithEmailAndPassword(
  BuildContext context, {
  required String email,
  required String password,
  Function(String)? onError,
  Function? onIncorrectCredentials,
  Function(User?)? onSignInSuccessful,
}) async {
  return await Provider.of<FireAuthProvider>(context, listen: false)
      .signInWithEmailAndPassword(
    email: email,
    password: password,
    onError: onError,
    onIncorrectCredentials: onIncorrectCredentials,
    onSignInSuccessful: onSignInSuccessful,
  );
}