evictFromCache static method

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

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<bool> evictFromCache(
  String url, {
  String? cacheKey,
  BaseCacheManager? cacheManager,
  double scale = 1,
}) async {
  final effectiveCacheManager = cacheManager ?? DefaultCacheManager();
  await effectiveCacheManager.removeFile(cacheKey ?? url);
  return CachedNetworkImageProvider(url, scale: scale).evict();
}