Hi,
I just notice that this library currently doesn't include caching. So any alternative solution?
What makes you think it's not caching?
Hi @renefloor ,
I have try first load with Internet connection and it is working fine.
After that, I enable airplane mode and kill and open apps again, the image is not showing out.
On which platform is this? Can you also give the url of the image?
I try on Android device
Sample URL i have try:
https://www.talkwalker.com/images/2020/blog-headers/image-analysis.png
@renefloor Hi, i try setup on a clean project and it is working, i think not working on my existing project maybe is caused by other library conflict issue.
BTW, i saw you guys write this
The CachedNetworkImage can be used directly or through the ImageProvider. Both the CachedNetworkImage as CachedNetworkImageProvider have minimal support for web. It currently doesn't include caching.
May i know what you guys means by 'It currently doesn't include caching.'?
The web version doesn't cache the images. If you just use the default I think it should automatically use the browser cache though. It is very difficult to manage files on the web.
Hey @renefloor can you talk to me about an alternative cache system for images in flutter web. I've used this package and also the default Image.network(), but nothing seems to cache the images.
My first guess was the misuse of the ListView.builder I was using. which pops off/does not load previous/next items until visible on the screen, but no, even when switching context, like (Navigating to a different page) was also reloading the images.
I'm also seeing that the caching is not working. Using the flutter network tools. This is a phone app not a web app in my case.
@rshrc @FacePalmDev
Hi, here I write down my experience on this library.
Is your image URL will changes after some time?
Because this library is using your image URL as the key of the cache, so if your URL is changed, then it will caused cache not working and download again.
Please note that http://www.example.com/image/1.png?token=ABC is different with http://www.example.com/image/1.png?token=ABCD
This library using cache.
So it means when dont have internet access, then it will load from cache.
If has internet then it will download again to ensure it is latest image.
If you need store to local and wont download if there has internet,
then you need to develop your own module by using flutter_cache_manager.
flutter_cache_manager has two function that we can use to getfile from URL:
So, if you want to have a module to download once only and next time will directly load from cache,
then you need to create your own module in the following step:
Most helpful comment
@rshrc @FacePalmDev
Hi, here I write down my experience on this library.
Is your image URL will changes after some time?
Because this library is using your image URL as the key of the cache, so if your URL is changed, then it will caused cache not working and download again.
Please note that http://www.example.com/image/1.png?token=ABC is different with http://www.example.com/image/1.png?token=ABCD
This library using cache.
So it means when dont have internet access, then it will load from cache.
If has internet then it will download again to ensure it is latest image.
If you need store to local and wont download if there has internet,
then you need to develop your own module by using flutter_cache_manager.
flutter_cache_manager has two function that we can use to getfile from URL:
- if have, then download from internet and store to local,
- if don't have, then it will find on local
So, if you want to have a module to download once only and next time will directly load from cache,
then you need to create your own module in the following step:
2.1 If no file return, then call getSingleFile(URL)
2.2 Else straight return file from cache