loadThemeMode static method

Future<ThemeMode> loadThemeMode()

Implementation

static Future<ThemeMode> loadThemeMode() async {
  final prefs = await SharedPreferences.getInstance();
  final theme = prefs.getString(_themeKey) ?? 'system'; // Default to system if no value exists
  switch (theme) {
    case 'light':
      return ThemeMode.light;
    case 'dark':
      return ThemeMode.dark;
    case 'system':
    default:
      return ThemeMode.system;
  }
}