delete method
Deletes the data associated with key
.
If key
does not exist, this method should do nothing.
This method will usually be called by NotifierPersistX.persist
when either
StorageOptions.destroyKey
changes or StorageOptions.cacheTime
expires.
Implementation
@override
FutureOr<void> delete(String key) {
if (key.endsWith(":expire_at") || key.endsWith(":destroy")) {
throw ArgumentError.value(key, 'key', 'Cannot use reserved keys');
}
_preferences.remove("$_prefix:$key");
_preferences.remove("$_prefix:$key:expire_at");
_preferences.remove("$_prefix:$key:destroy");
}