Vib*_*ngh 3 firebase flutter firebase-storage
我看过几个关于在 firebase 存储中上传文档的示例,但没有将文件列表从 firebase 存储下载到 flutter 的文档。在 Firebase 文档上,有很多关于 Android、iOS、web、c++ 等的 firebase 存储的文档,但不是 flutter。特别是如果我谈论视频
VideoPlayerController videoPlayerController;
@override
void initState() {
videoPlayerController = VideoPlayerController.network('/* Download Url*/');
super.initState();
}
Run Code Online (Sandbox Code Playgroud)
视频在应用程序初始化时需要Url
要查找从 Flutter 上传和下载文件到 Cloud Storage 的示例,请查看 FlutterFire 库的示例应用程序firebase_storage。
该过程主要包括获取下载 URL,它使您可以对文件进行只读访问:
final String url = await ref.getDownloadURL();
Run Code Online (Sandbox Code Playgroud)
然后从该 URL 加载数据:
final http.Response downloadData = await http.get(url);
Run Code Online (Sandbox Code Playgroud)
查看完整示例的_downloadFile方法。
| 归档时间: |
|
| 查看次数: |
9788 次 |
| 最近记录: |