Last active
March 29, 2022 20:41
-
-
Save marcoleonardini/755974426ad4271dadeb3c7364971bd8 to your computer and use it in GitHub Desktop.
get preferences
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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