evictFromCache static method

Future evictFromCache(
  1. String url, {
  2. String? cacheKey,
  3. BaseCacheManager? cacheManager,
  4. double scale = 1.0,
})

Evict an image from both the disk file based caching system of the BaseCacheManager as the in memory ImageCache of the ImageProvider. url is used by both the disk and memory cache. The scale is only used to clear the image from the ImageCache.

Implementation

static Future evictFromCache(
  String url, {
  String? cacheKey,
  BaseCacheManager? cacheManager,
  double scale = 1.0,
}) async {
  cacheManager = cacheManager ?? DefaultCacheManager();
  await cacheManager.removeFile(cacheKey ?? url);
  return OptimizedCacheImageProvider(url, scale: scale).evict();
}