Skip to content

Instantly share code, notes, and snippets.

@marcoleonardini
Last active March 29, 2022 20:41
Show Gist options
  • Save marcoleonardini/755974426ad4271dadeb3c7364971bd8 to your computer and use it in GitHub Desktop.
Save marcoleonardini/755974426ad4271dadeb3c7364971bd8 to your computer and use it in GitHub Desktop.
get preferences
static Future getKeyPreference(String key) async {
SharedPreferences? prefs;
try {
prefs = await SharedPreferences.getInstance();
return prefs.getString(key) ?? '';
} catch (e) {
throw Exception();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment