removeFromCache static method

void removeFromCache(
  1. String itemPath
)

Remove an item from the cache (used after deletion).

Implementation

static void removeFromCache(String itemPath) {
  // Find the parent directory in cache and remove the item.
  final parentPath = _getParentFromItemPath(itemPath);
  final cached = _cache[parentPath];
  if (cached != null) {
    final (items, timestamp) = cached;
    final updated = items.where((i) => i.path != itemPath).toList();
    _cache[parentPath] = (updated, timestamp);
    debugPrint('PodDirectoryService: Removed from cache: $itemPath');
  }
}