getKV method
dynamic
getKV(
- dynamic key,
- dynamic value
gets a Key/Value pair from the preferences
Implementation
dynamic getKV(var key, var value) async {
SharedPreferences sharedPreferences = await getSharedPreferencesInstance();
if (value is bool) {
this._returnValue = sharedPreferences.getBool(key);
} else if (value is String) {
this._returnValue = sharedPreferences.getString(key);
} else if (value is int) {
this._returnValue = sharedPreferences.getInt(key);
} else if (value is double) {
this._returnValue = sharedPreferences.getDouble(key);
} else if (value is List<String>) {
this._returnValue = sharedPreferences.getStringList(key);
}
if (this._returnValue == null) {
this._returnValue = value;
}
return this._returnValue;
}