Preferences Service
Component Detail
Description
Riverpod provider that reads and writes user preferences to the local Drift user_preferences table and enqueues sync mutations to the backend, so settings survive reinstalls and offline periods. Exposes reactive streams consumed by the design token system and the organization labels provider to trigger immediate UI updates on preference change.
preferences-service
Sources & reasoning
The Preferences Service is the core service mandated by the feature description - preferences must be stored in Drift, flushed via mutation outbox for offline resilience, and exposed as Riverpod providers so the design token system and org labels provider react to font-scale and terminology changes without manual refresh.
No source references — this artifact was included based on reasoning alone (see above).
Responsibilities
- Persist preference key-value pairs to local Drift table via SQLCipher-encrypted DB
- Enqueue preference changes to mutation outbox for transparent backend sync
- Expose Riverpod providers for font scale, notification opt-ins, and accessibility flags
- Notify design token system and org labels provider on relevant preference changes
- Hydrate preferences from backend on first install or after reinstall
Interfaces
getPreference(String key): dynamic
setPreference(String key, dynamic value): Future<void>
watchPreference(String key): Stream<dynamic>
syncPreferencesToBackend(): Future<void>
loadPreferencesFromBackend(): Future<void>
resetToDefaults(): Future<void>
Relationships
Dependencies (2)
Components this component depends on
Dependents (2)
Components that depend on this component