我不想将图像存储在缓存中..我使用 CachedNetworkImage 进行图像加载..我想知道是否有任何选项可以像毕加索一样删除或不将图像存储在缓存中..
我的代码:
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),
);
我试过了
annotatedImg.cacheManager.emptyCache();
但它的节目不能调用 emptyCache 是空的..
原文由 Navin Kumar 发布,翻译遵循 CC BY-SA 4.0 许可协议
首先将包(flutter_cache_manager)添加到 pubspec.yaml 文件中,如下所示:
依赖项:颤振:sdk:颤振 _flutter_cache_manager:^1.1.3_
一天后,我找到了解决方案。通过调用 emptyCache() 方法使用 DefaultCacheManager 对象,这会清除缓存数据。