英文:
Load multiple images from Firestore in Flutter
问题
假设我有一个Firebase集合,其中包含一些记录如下:
Product { name : "Speaker", image_name: "spkr01.png" }
此外,名为**(spkr01.png)**的图像已经存储在Firestore中。
我已经从数据库加载了所有产品,那么如何在ListView中加载每个产品对应的图像呢?
我尝试了一些解决方案,但没有一个能让它工作,甚至一个图像对我都无法工作。
英文:
Assuming that i have firebase collection within i have some records like this :
Product
{
name : "Speaker",
image_name: "spkr01.png"
}
in addition, the image with name (spkr01.png) already stored in firestore,
i already loaded all products from database, so how to load every image for corresponds products in listview
i have tried some solution, but i didn't make it to work even one image it doesn't work for me.
答案1
得分: 0
最好存储图像URL而不是图像名称。而且,我假设你是指将图像上传到Firebase存储。在上传到存储后获取图像URL,并将图像URL写入产品的image_url参数。
英文:
It's better to store image URL instead of image name. And, I assume you meant your uploaded to Firebase Storage. Get image url after you upload to Storage and write image URL to product's image_url parameter.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论