dart - 如何从颤动的缓存图像网络中获取路径?
问题描述
我是flutter的新手,我想知道如何从flutter中的缓存图像网络获取路径,或者如何将网络图像保存到资产图像并获取该图像的路径?
解决方案
更新的方法是使用DefaultCacheManager
Flutter Cache Manager包。
final cache = DefaultCacheManager(); // Gives a Singleton instance
final file = await cache.getSingleFile(yourURL);
// Now use file.path
推荐阅读
- css - 具有自适应高度的 iframe,适合页面的“其余部分”
- c# - 使用 Prism 中的 ViewDiscovery 构建简单的菜单结构
- python-3.x - 如何提高数据加载性能python
- javascript - 解析错误;JavaScript中的意外令牌索引
- python-3.x - 在特定字符之间搜索最后一组文本
- bash - Git别名在克隆时自动为个人回购信息添加前缀?
- ios - 每次我在 Swift 中使用它时都必须启动一个 BLE 外围设备
- javascript - 来自 react-router-dom 的提示问题未触发
- mysql - 在存储过程中调用存储过程并将结果设置为变量时出现问题
- typescript - VSCode API:在终端中运行命令并使用输出