Login Use Case
domain/usecases
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
- AuthController.login() instantiates LoginParams(email, password).
- call(params) trims + lowercases the email and runs basic format checks.
- Delegates to AuthRepository.login(email, password).
- Repository returns Either<AuthFailure, User> — passed through unchanged.
- 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.