Auth Repository
domain/repositories
Overview
Abstract contract in the domain layer + concrete AuthRepositoryImpl in the data layer. The single seam between use cases and the outside world (network + storage).
User Flow
- Use cases depend on the abstract interface only — they never see the impl.
- Impl orchestrates RemoteDataSource (HTTP) + LocalDataSource (token cache).
- Wraps every call in try/catch, mapping exceptions to typed AuthFailure values.
- Returns Either<AuthFailure, T> upward — no exceptions cross the boundary.
Cases & Edge Cases
- Network call succeeds but local cache write fails — propagate user but log warning; next boot will re-sync.
- Token refresh race: two parallel 401s should trigger only one refresh attempt (mutex).
- Offline boot: trust the cached token until the next protected call rejects it.
Code References
- lib/features/auth/domain/repositories/auth_repository.dart // abstract
- lib/features/auth/data/repositories/auth_repository_impl.dart // impl
API Calls
Empty — fill this in later. Open the manifest and add content here.
Notes
All exception → AuthFailure mapping lives in the impl. Adding a new error case? Map it here, not in the use cases.