getTheme method

Future<bool> getTheme()

Retrieves the current theme from SharedPreferences as a boolean value.

The retrieved value is true if the app is currently using the dark theme, and false otherwise.

If the theme is not set, the default value is false (i.e. the light theme).

Implementation

Future<bool> getTheme() async {
  final sharedPreferences = await SharedPreferences.getInstance();
  return sharedPreferences.getBool(themeKey) ?? false;
}