Service Layer medium complexity mobile
0
Dependencies
0
Dependents
3
Entities
0
Integrations

Description

Business logic layer for reading and writing user preferences. Persists preferences locally via shared_preferences for immediate UI response and syncs to the Supabase user profile for cross-device consistency using Riverpod async notifiers. Handles org-specific feature flag loading at session start.

Feature: Settings & Preferences

preferences-service

Responsibilities

  • Read and write user preferences to local storage and Supabase
  • Load and cache org-specific feature flags from Supabase
  • Synchronize local preferences with remote user profile on session changes
  • Provide Riverpod providers for reactive preference state throughout the app

Interfaces

getPreference<T>(String key)
setPreference<T>(String key, T value)
syncPreferencesToRemote(String userId)
loadFromRemote(String userId)
loadOrgFeatureFlags(String orgId)
getFeatureFlag(String flagKey)
watchPreference<T>(String key)
clearLocalPreferences()