invalidate method

void invalidate(
  1. String key
)

Implementation

void invalidate(String key) {
  final cached = _cache.remove(key);
  if (cached != null) {
    cached.picture.dispose(); // ✅ Explicit disposal
    _currentMemory = (_currentMemory - cached.memoryBytes)
        .clamp(0, _maxTrackedMemoryBytes)
        .toInt();
  }
}