remove method
Removes the value stored under a key from this stash if present.
key
: key whose mapping is to be removed from the stash
Implementation
@override
Future<void> remove(String key) {
// Current time
final now = clock.now();
// #region Statistics
Stopwatch? watch;
Future<void> Function(dynamic) posRemove = (_) => Future<void>.value();
if (statsEnabled) {
watch = clock.stopwatch()..start();
posRemove = (_) {
stats.increaseRemovals();
if (watch != null) {
stats.addRemoveTime(watch.elapsedMicroseconds);
watch.stop();
}
return Future<void>.value();
};
}
// #endregion
return _removeEntryByKey(key, now).then(posRemove);
}