themeModePrefProvider top-level property

StateNotifierProvider<PreferenceNotifier<ThemeMode>, ThemeMode> themeModePrefProvider
final

Provides the user's preferred theme mode.

This may be a forced light theme, forced dark theme, or the system's preferred theme.

This value is persisted using shared preferences.

Defaults to forced dark theme (ThemeMode.dark).

Implementation

final themeModePrefProvider =
    StateNotifierProvider<PreferenceNotifier<ThemeMode>, ThemeMode>(
  (ref) => PreferenceNotifier.watchEnum(
    ref,
    'themeMode',
    defaultValue: ThemeMode.dark,
    values: ThemeMode.values,
  ),
);