getSettings method

  1. @override
Future<ClockSettings> getSettings()
override

Implementation

@override
Future<ClockSettings> getSettings() async {
  final prefs = await SharedPreferences.getInstance();
  final themeMode =
      (prefs.getString('themeMode') ?? 'dark') == 'dark' ? ThemeMode.dark : ThemeMode.light;
  final timeFormat =
      (prefs.getString('timeFormat') ?? 'h24') == 'h24' ? TimeFormat.h24 : TimeFormat.h12;
  final isFlipped = prefs.getBool('isFlipped') ?? false;
  final isWeatherEnabled = prefs.getBool('isWeatherEnabled') ?? true;
  return ClockSettings(
    themeMode: themeMode,
    timeFormat: timeFormat,
    isFlipped: isFlipped,
    isWeatherEnabled: isWeatherEnabled,
  );
}