Flutter save a network image to local directory

后端 未结 10 606
情歌与酒
情歌与酒 2020-12-24 08:52

In Flutter how to save an image from network to the local directory.

I am new to encoding and decoding images. Can anyone point me in the right direction?

10条回答
  •  醉梦人生
    2020-12-24 09:42

    You can use image_downloader.

    • For ios, image is saved in Photo Library.
    • For Android, image is saved in Environment.DIRECTORY_DOWNLOADS or specified location. By calling inExternalFilesDir(), specification of permission becomes unnecessary.
    • By callback(), you can get progress status.

    The following is the simplest example. It will be saved.

    await ImageDownloader.downloadImage(url);
    

提交回复
热议问题