i dont want to store image in cache.. iam using CachedNetworkImage for image loading.. I want know is there any option to remove or do not store image in cache like picasso..
my code:
var annotatedImg = CachedNetworkImage(
fit: BoxFit.fill,
imageUrl: Constants.IMAGE_BASE_URL + widget._fileId + Constants.CONTOUR_IMG_SUFFIX,
placeholder: (context, url) => progressBar,
errorWidget: (context, url, error) => new Icon(Icons.error),
);
i have tried
annotatedImg.cacheManager.emptyCache();
but its shows cant call emptyCache is null..
Go to Tools > Flutter > Flutter Clean to clear the build cache of the Flutter project.
Another tricky solution is to add a dummy argument which changes every time, then the image will be treat as different image source and will refresh image every time when you access it. For example add t=currentTimestamp, but you don't need handle this argument in the web server.
Cached network imageA flutter library to show images from the internet and keep them in the cache directory.
Since CachedNetworkImage version 2.3, all these solutions won't work because it cached images in 2 different places (DefaultCacheManager & NetworkImageProvider)
So the only solution is using the evictFromCache
built-in method from CachedNetworkImage
like this:
Future _deleteImageFromCache() async {
String url = "your url";
await CachedNetworkImage.evictFromCache(url);
}
evictFromCache
is a Static method so it doesn't require to have the CachedNetworkImage
in your Widget tree, you can use it directly from any place.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With