arch-atlas

Login Use Case

domain/usecases

domain

Overview

Single-purpose use case for signing a user in with email + password. Validates inputs, calls AuthRepository.login and lifts the result into Either<AuthFailure, User>.

User Flow

  1. AuthController.login() instantiates LoginParams(email, password).
  2. call(params) trims + lowercases the email and runs basic format checks.
  3. Delegates to AuthRepository.login(email, password).
  4. Repository returns Either<AuthFailure, User> — passed through unchanged.
  5. Controller maps Left → snackbar, Right → cache user + navigate to /home.

Cases & Edge Cases

  • Empty / malformed email → returns Left(AuthFailure.invalidEmail) without hitting the network.
  • Password shorter than 6 chars → Left(AuthFailure.weakPassword).
  • Server returns 401 → Left(AuthFailure.invalidCredentials).
  • Connectivity drop mid-call → Left(AuthFailure.network).

Code References

  • lib/features/auth/domain/usecases/login_usecase.dart
  • lib/features/auth/domain/repositories/auth_repository.dart:18 // login()

API Calls

Empty — fill this in later. Open the manifest and add content here.

Notes

Stays free of Get/GetIt/HTTP — it's the boundary the controller talks to. Add new validation rules here, not in the controller.