Downloading Files from firebase storage to flutter

。_饼干妹妹 提交于 2020-03-22 09:14:06

问题


I have seen several examples regarding uploading a document in firebase storage but there is no document of downloading a list of files from firebase storage to flutter. On Firebase docs, there is a lot of documentation on firebase storage for Android, iOS, web, c++ etc. but not flutter. Specially if I Talk about Video's

VideoPlayerController videoPlayerController;
  @override
  void initState() {

    videoPlayerController = VideoPlayerController.network('/* Download Url*/');
    super.initState();
  }

Video's needs Url in the initialization of the app


回答1:


To find an example of uploading and downloading file to Cloud Storage from Flutter, have a look at the example application of the FlutterFire library firebase_storage.

The process mostly consists of getting a download URL, which gives you read-only access to the file:

final String url = await ref.getDownloadURL();

And then loading the data from that URL with:

final http.Response downloadData = await http.get(url);

Check out the _downloadFile method for the full example.



来源:https://stackoverflow.com/questions/56610221/downloading-files-from-firebase-storage-to-flutter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!