remove method
Removes the entry for the specified key
from the cache, if it exists.
Returns the removed value, or null
if the key was not present.
Updates the cache size accordingly. The operation is thread-safe.
Implementation
@override
Future<Uint8List?> remove(key) async {
assert(key.isNotEmpty, 'key must not be empty');
return await lock.synchronized(() {
final Uint8List? previous = map.remove(key);
if (previous != null) {
size -= previous.lengthInBytes;
}
return previous;
});
}