loginWithEmailAndPassword method

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

Attempts to log in a user using their email and password.

This function sends a request to the API client with the provided email and password. If the login is successful, it returns the user information. In case of an error, the error is recorded in Crashlytics and the error is rethrown.

email The email address of the user trying to log in. password The password of the user.

Returns a Future<User> containing the user's information on successful login.

Throws an error if the login fails for any reason.

Implementation

Future<User> loginWithEmailAndPassword(String email, String password) =>
    _apiClient.loginWithEmailAndPassword({
      'email': email,
      'password': password,
    }).catchError((error) {
      _crashlytics?.recordError(error, StackTrace.current);
      throw error;
    });