Skip to content

Instantly share code, notes, and snippets.

@ashishrawat2911
Last active January 11, 2020 19:09
Show Gist options
  • Save ashishrawat2911/2bc3d85c0a31bd1c2bf9009a8f865f88 to your computer and use it in GitHub Desktop.
Save ashishrawat2911/2bc3d85c0a31bd1c2bf9009a8f865f88 to your computer and use it in GitHub Desktop.
getStringValuesSF() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
//Return String
String stringValue = prefs.getString('stringValue');
return stringValue;
}
getBoolValuesSF() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
//Return bool
bool boolValue = prefs.getBool('boolValue');
return boolValue;
}
getIntValuesSF() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
//Return int
int intValue = prefs.getInt('intValue');
return intValue;
}
getDoubleValuesSF() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
//Return double
double doubleValue = prefs.getDouble('doubleValue');
return doubleValue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment