switchTheme method

Future<void> switchTheme(
  1. ThemeMode themeMode
)

Switch to a specific theme mode

Implementation

Future<void> switchTheme(ThemeMode themeMode) async {
  try {
    state = themeMode;
    await JetStorage.write(_storageKey, themeMode.name);
    dump('[ThemeSwitcher] Theme switched to: ${themeMode.name}');
  } catch (e, stackTrace) {
    dump('[ThemeSwitcher] Error saving theme: $e', stackTrace: stackTrace);
  }
}