flutter_cache_manager
flutter_cache_manager copied to clipboard
Use a custom key for caching
How can I use a custom key for caching instead of the url? When I use the CachedNetworkImage widget, I want to use the customized cache manager. My thought was to extend CacheManager and override its getSingleFile and other methods. But it doesn't seem to work.
I haven't used CachedNetworkImage, but I have used the putFile function, which has a key parameter. You can then get the file using CacheManager.getFileFromCache. So, you can first check if the file exists using this function, and if it doesn't, then you can download it (using http, dio, or something else) and use the putFile function to store it.