如何使用Flutter在Firebase Storage目录中获取所有文件 [英] How to get all files inside a Firebase Storage directory using Flutter

查看:71
本文介绍了如何使用Flutter在Firebase Storage目录中获取所有文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个显示夜总会描述和图像的应用程序.每个俱乐部有大约4个相关图像.在Firebase Storage中,我为每个俱乐部创建了目录,然后将其图像存储在其中.

I have an App that display nightclub description and image. Each club have about 4 related image. In Firebase Storage i have created directory for each club and then stored their image inside.

所以我要做的是从俱乐部目录中获取所有图像,以便我可以在我的应用程序中显示所有图像

so what i want to do is getting all the image from a club directory so i can display all the image in my app

我认为实现此目的的一种方法是获取每个图像的 DownloadUrl .

i think a way of achieving this would be to get the DownloadUrl of each image.

我已经尝试过:

最终存储参考firebaseStorageRef = FirebaseStorage.instance.ref() .child('profilePics/$ clubID/SomeImage.jpg').getDownloadURL();

但是由于我事先不知道所存储图像的名称,所以我不能使用它

but since i don't know in advance the name of the image stored i can't use this

那么有什么办法吗?

推荐答案

如果您不知道Cloud Storage中对象的完整路径,则无法使用移动客户端SDK对其进行任何操作.通常,一个人在将下载URL上传到存储桶时会获得下载URL,然后将该URL写入数据库,以便以后查询.

If you don't know the full path of an object in Cloud Storage, then you can't do anything with it using the mobile client SDKs. Typically, one gets the download URL at the time it was uploaded to the bucket, then writes that URL to a database so it can be queried for later.

这篇关于如何使用Flutter在Firebase Storage目录中获取所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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