toggleTheme static method

Future<void> toggleTheme()

toggleTheme toggles the theme between two values.

The two values:

  • dark
  • light

Implementation

static Future<void> toggleTheme() async {
  final ThemeMode themeMode = getThemeMode();
  switch (themeMode) {
    case ThemeMode.system:
    case ThemeMode.light:
      await setDark();
      break;
    case ThemeMode.dark:
      await setLight();
      break;
  }
}