toggleTheme method

void toggleTheme()

Flips between light and dark, taking the resolved currentMode as the starting point. Always sets mode to a concrete ThemeMode.light or ThemeMode.dark — toggling out of ThemeMode.system.

Implementation

void toggleTheme() {
  final next = currentMode.value == ThemeMode.light
      ? ThemeMode.dark
      : ThemeMode.light;
  runInAction(() => mode.value = next);
}