clearCache method

void clearCache()

Removes all cached images.

This calls Image.dispose for all images in the cache, so make sure that you don't use any of the previously cached images once clearCache has been called. Retained images are removed too.

Implementation

void clearCache() {
  _assets.forEach((_, asset) => asset.dispose());
  _assets.clear();
  _evictedKeys.clear();
}