Skip to content

Settings Providers

Source: Various files in pharmanet/lib/core/providers/

Profile Provider

final profileProvider = StateNotifierProvider<ProfileNotifier, AsyncValue<Profile?>>((ref) {
  return ProfileNotifier(ref.read(profileApiProvider));
});
Action Description
fetchProfile() Load user profile
updateProfile(data) Update profile fields
uploadProfilePicture(file) Upload and set avatar
saveFcmToken(token) Save FCM push token

Security Settings Provider

final securitySettingsProvider = StateNotifierProvider<SecuritySettingsNotifier, AsyncValue<SecuritySettings?>>((ref) {
  return SecuritySettingsNotifier(ref.read(securitySettingsApiProvider));
});

Manages: biometric, 2FA, PIN lock, privacy toggles.

App Lock Provider

final appLockProvider = StateNotifierProvider<AppLockNotifier, AppLockState>((ref) {
  return AppLockNotifier(ref.read(secureStorageServiceProvider));
});
State Description
AppLockStatus.locked PIN entry required
AppLockStatus.unlocked App accessible
AppLockStatus.lockout Too many failed attempts

Locale Provider

final localeProvider = NotifierProvider<LocaleNotifier, Locale>(LocaleNotifier.new);

Switches between Locale('en') and Locale('am') with persistence via LocaleService.

Privacy Conditions Provider

final privacyConditionsProvider = StateNotifierProvider<PrivacyConditionsNotifier, AsyncValue<PrivacyConditionsStatus>>((ref) {
  return PrivacyConditionsNotifier();
});

Tracks acceptance of terms/privacy policy.

UI Provider

final appViewModeProvider = StateNotifierProvider<AppViewModeNotifier, AppViewMode>((ref) {
  return AppViewModeNotifier();
});
enum AppViewMode { customer, seller }

Toggles between customer and seller view within the same app.