remove method

T? remove(
  1. String? key
)

Removes the entry for key (if any) and returns its value, or null if the key was absent or expired.

Implementation

T? remove(String? key) {
  if (key == null) return null;
  _expirationTimers.remove(key)?.cancel();
  final item = _cache.remove(key);
  if (item == null || item.isExpired) return null;
  return item.value;
}