evictFromCache static method
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 ?? CachedNetworkImageProvider.defaultCacheManager;
await effectiveCacheManager.removeFile(cacheKey ?? url);
return CachedNetworkImageProvider(url, scale: scale).evict();
}