Download file from url, save to phones storage

后端 未结 4 1788
感动是毒
感动是毒 2020-12-30 06:56

I\'m working on a project, that requires me to download a file from URL, once a button is tapped, and store it to phone storage (probably downloads folder).

Any idea

4条回答
  •  醉酒成梦
    2020-12-30 07:32

    Use https://pub.dartlang.org/packages/flutter_downloader. Don't forget to do platform configurations.

    Basically, this is how you should use the package. There is a detailed long example in the link.

    final taskId = await FlutterDownloader.enqueue(
      url: 'your download link',
      savedDir: 'the path of directory where you want to save downloaded files',
      showNotification: true, // show download progress in status bar (for Android)
      openFileFromNotification: true, // click on notification to open downloaded file (for Android)
    );
    

提交回复
热议问题