auth<T extends CoffeeModel> method

CoffeeAuthRequest<T> auth<T extends CoffeeModel>()

Service to handle authentication

Example usage:

var isLoggedIn = coffeeService.auth<User>().isLoggedIn();

Implementation

CoffeeAuthRequest<T> auth<T extends CoffeeModel>() {
  // Each time `auth` is called, a new instance of `CoffeeAuthRequest` is created.
  // This ensures that the `fromJson` function matches the type `T`.
  return CoffeeAuthRequest<T>(
    baseEndpoint: baseUrl,
    httpClient: httpClient,
    fromJson: Coffee.getUserModelFromJson(),
  );
}