Local Data Source
data/datasources (token cache)
Overview
Persists the auth token + cached user in flutter_secure_storage. Read on boot to restore the session, written after login/register, cleared on logout.
User Flow
- saveSession(AuthToken, UserModel) — JSON-encodes both, writes under namespaced keys.
- readSession() → returns (token, user) or null when absent.
- clearSession() — wipes both keys atomically.
Cases & Edge Cases
- Secure storage unavailable on emulator/web → fall back to SharedPreferences with a clear log warning.
- Corrupt JSON in storage → treat as 'no session' and clear the keys defensively.
Code References
- lib/features/auth/data/datasources/local/auth_local_datasource.dart
API Calls
Empty — fill this in later. Open the manifest and add content here.
Notes
Never store the password. Only the issued token + the public user payload. Token rotation invalidates whatever is cached here.