setThemeMode method

Future<void> setThemeMode(
  1. ThemeMode themeMode
)

Sets the theme mode and saves it to shared preferences.

Implementation

Future<void> setThemeMode(ThemeMode themeMode) async {
  String themeModeString;
  switch (themeMode) {
    case ThemeMode.light:
      themeModeString = 'light';
      break;
    case ThemeMode.dark:
      themeModeString = 'dark';
      break;
    case ThemeMode.system:
      themeModeString = 'system';
      break;
  }

  await _prefs.setString(_themeModeKey, themeModeString);
}