getThemeModeFromPreferences method

dynamic getThemeModeFromPreferences()

Implementation

getThemeModeFromPreferences() async {
  ThemeMode themeMode;
  GetStorage box = GetStorage();
  String themeText = box.read('theme') ?? 'dark';
  try {
    themeMode =
        ThemeMode.values.firstWhere((e) => describeEnum(e) == themeText);
  } catch (e) {
    themeMode = ThemeMode.system;
  }
  setThemeMode(themeMode);
}