How to save ImageCache to the disk in flutter?

时间:2017-06-15 09:58:37

标签: android flutter image-caching

I load lots of image from the internet with Image.network statement and I know the ImageCache only save them until then the app is running. But I want save cache, because I don't want always downloading images, when app starting. So: save cache to the disk is possible in flutter?

1 个答案:

答案 0 :(得分:1)

Flutter的image cache用于解码图像。听起来你想要的是编码图像文件的缓存。

您可以通过下载到文件到设备存储并使用Image.file来自行构建,但您可能希望实现某种逐出逻辑以确保不会在设备上占用太多空间

您可以将Image.asset用于要与应用捆绑在一起的静态图片。

考虑在用户到达显示图像之前预先加载图像。这将产生他们立即加载的错觉。