Baseflow / flutter_cache_manager

Generic cache manager for flutter
https://baseflow.com
MIT License
740 stars 429 forks source link

Custom Cache Manager not working after version 2.0.0 #282

Closed pankajrohilla893 closed 3 years ago

pankajrohilla893 commented 3 years ago

🐛 Bug Report

class CustomCacheManager { static const key = 'customCacheObject'; static CacheManager instance = CacheManager(Config(key, stalePeriod: Duration(days: 120), maxNrOfCacheObjects: 1000)); }

Trying to make Custom Cache Manager like above but unable to do that, caching is not happening.

DefaultCacheManager() is working properly.

Accessing above like below:

var file = await CustomCacheManager.instance.downloadFile( "${env.baseUrl}", authHeaders: requestHeaders);

Version: 2.1.1

Platform:

renefloor commented 3 years ago

the downloadFile method always downloads the file (and puts it in the cache). I tried your cacheManager with getFileStream and caching works as expected.

    CustomCacheManager.instance
        .getFileStream('https://via.placeholder.com/150', withProgress: false)