Just want to get clarification on below coding. cacheDuration set seconds to 0 caches avatar.jpg for the app session, any subsequent used is getting from cache. Once app is closed, avatar.jpg will be deallocated from cache. Am I right ?
CachedNetworkImage( imageUrl: 'https://example.com/avatar.jpg', cacheDuration: const Duration(seconds: 0), );
cached_network_image use the flutter_cache_manager library to manage cached files. Here is what the doc says :
the cache deletes files when there are too many, ordered by last use, and when files just haven't been used for longer than the stale period
So I think your solution with a Duration of 0 will work but you can also try a cleaner solution (I think): try to delete all the cached image at the start of your app (in the main()
method for exemple).
To clean all cache you can try this (it will remove old cached images):
await DefaultCacheManager().emptyCache();