getThemeMode method
Retrieves the current ThemeMode from SharedPreferences.
Returns a Future<ThemeMode>
representing the stored theme mode,
which can be light, dark, or system. If no theme mode is set,
defaults to ThemeMode.system.
Implementation
Future<ThemeMode> getThemeMode() async {
final sharedPreferences = await SharedPreferences.getInstance();
final modeIndex = sharedPreferences.getInt(themeModeKey);
return modeIndex != null ? ThemeMode.values[modeIndex] : ThemeMode.system;
}