Skip to content

Instantly share code, notes, and snippets.

@dafinoer
Last active May 14, 2019 15:21
Show Gist options
  • Save dafinoer/1c322a12a104c191326fad51338bd7b4 to your computer and use it in GitHub Desktop.
Save dafinoer/1c322a12a104c191326fad51338bd7b4 to your computer and use it in GitHub Desktop.
class SharedPrefPage {
final String _themeMode = 'modeTheme';
Future<void>setPrefDark(bool value) async {
final sharedpf = await SharedPreferences.getInstance();
sharedpf.setBool(_themeMode, value);
}
Future<bool> getThemePref() async {
final sharedprefmode = await SharedPreferences.getInstance();
return sharedprefmode.getBool(_themeMode);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment