remove method

  1. @override
Future<bool> remove(
  1. String key
)
override

Removes a specific value from the cache.

key - Unique identifier of the value to remove

Returns true if removed successfully, false if it didn't exist

Implementation

@override
Future<bool> remove(String key) async {
  await _ensureInitialized();

  final existed = _metadataCache.containsKey(key);

  if (existed) {
    // Remove from SharedPreferences
    await _prefs!.remove('$_keyPrefix$key');
    await _prefs!.remove('$_metadataPrefix$key');

    // Remove from in-memory cache
    _metadataCache.remove(key);
  }

  return existed;
}