将文件从Firebase存储下载到Flutter [英] Downloading Files from firebase storage to flutter

查看:75
本文介绍了将文件从Firebase存储下载到Flutter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到几个有关在Firebase存储器中上载文档的示例,但是没有文档将文件列表从Firebase存储器中下载到Flutter. 在Firebase文档上,有很多关于Android,iOS,Web,C ++等的Firebase存储的文档,但没有变化. 特别是如果我谈论视频的

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

推荐答案

要查找从Flutter将文件上传和下载到Cloud Storage的示例,请查看

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.

该过程主要包括获取下载URL,该URL授予您对该文件的只读访问权限:

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

final String url = await ref.getDownloadURL();

然后使用以下方法从该URL加载数据:

And then loading the data from that URL with:

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

查看 _downloadFile方法作为完整示例.

Check out the _downloadFile method for the full example.

这篇关于将文件从Firebase存储下载到Flutter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆