remove method
Removes an object by its key.
This method validates the key, removes the object from the backend storage, and notifies all global listeners and key-specific listeners for this key. If the key doesn't exist, no error is thrown (the operation is idempotent).
Parameters:
key- The key of the object to remove. Must be non-empty, not only whitespace, and not contain the delimiter.
Throws:
- ArgumentError if the key is invalid
See also:
- removeItem for removing by object
- removeAll for removing multiple objects by key
- clear for removing all objects
Implementation
@override
Future<void> remove(String key) async {
validateKey(key);
await backend.remove(encodeKey(key));
notifyListeners(key);
}