set method
Sets content for given key with Duration
Implementation
Future<bool> set(String key, dynamic value, {Duration? validFor}) async {
_listeners.forEach((listener) {
listener.keySet(key);
});
if (validFor != null) {
_save(_withValidSuffix(key),
DateTime.now().add(validFor).toIso8601String());
} else {
SharedPreferences prefs = await _getSharedPreferences();
if (prefs.containsKey(_withValidSuffix(key))) {
prefs.remove(_withValidSuffix(key));
}
}
return _save(key, value);
}