How to save ImageCache to the disk in flutter?

1,049

Flutter's image cache is for decoded images. It sounds like what you want is a cache of encoded image files.

You could build this yourself by downloading to files to device storage and using Image.file, but you'd probably want to implement some kind of eviction logic to make sure you don't consume too much space on the device.

You could use Image.asset for static images that you want to bundle with your app.

Consider preloading your images before the user gets to the point where they are displayed. This will create the illusion that they load instantly.

Share:
1,049
ZeroProcess
Author by

ZeroProcess

Updated on December 02, 2022

Comments

  • ZeroProcess
    ZeroProcess over 1 year

    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?