Flatter firebase firestore:如何获取存储在阵列firestore中的图像?

Flatter firebase firestore:如何获取存储在阵列firestore中的图像?,firebase,flutter,google-cloud-firestore,Firebase,Flutter,Google Cloud Firestore,我想通过存储在Firebase firestore中的url显示带有索引的图像,我正在获取存储在云存储中的图像,但我不知道如何获取存储在Firebase firestore中的url,该url位于数组中。请帮助我,因为我只是一个初学者,通过互联网学习。图片附在下面。提前谢谢 List<String> urls = []; @override void initState() { super.initState(); _getImages(); } 将其放入ge

我想通过存储在Firebase firestore中的url显示带有索引的图像,我正在获取存储在云存储中的图像,但我不知道如何获取存储在Firebase firestore中的url,该url位于数组中。请帮助我,因为我只是一个初学者,通过互联网学习。图片附在下面。提前谢谢

List<String> urls = [];

  @override
  void initState() {
  super.initState();

 _getImages();
 
}

将其放入
getImages()
函数中

//First, you must retrieve your document, like this:
DocumentSnapshot firebaseDoc = await FirebaseFirestore.instance.collection('users').doc('yourDocumentId').get();

//then you need to extract your list, which is in the 'images' field, you can do so like this:
List<String> imagesList = firebaseDoc.data()['images'];

//Now, you have a list, containing the URLs you want.
print(imagesList[0]); //should print the first URL, you can take it from here
//首先,您必须检索文档,如下所示:
DocumentSnapshot firebaseDoc=等待FirebaseFirestore.instance.collection('users').doc('yourDocumentId').get();
//然后,您需要提取“图像”字段中的列表,您可以这样做:
List imagesList=firebaseDoc.data()['images'];
//现在,您有了一个列表,其中包含您想要的URL。
打印(图像列表[0])//如果要打印第一个URL,您可以从这里获取它

谢谢您的回复,但现在我发现了这个错误。“未处理的异常:类型'List'不是类型'List'的子类型”将其更改为:
List imagesList=firebaseDoc.data()['images']仍然是相同的错误--[error:flatter/lib/ui/ui\u dart\u state.cc(186)]未处理的异常:类型“List”不是类型“List”的子类型很抱歉用新查询打扰您,现在它正在控制台中打印所有url,但没有索引,我在删除图像时需要索引,但它仍然没有显示在容器中,如何使用索引显示它们?您不需要索引,只需删除所需的元素,而无需通过索引。
_getImages() async {

ListResult _result = await _stoarge.ref().child("images").list(ListOptions(maxResults: 10));
_result.items.forEach((_ref) async {
  String _u = await _ref.getDownloadURL();

  urls.add(_u);
  setState(() {
    print(urls.length);
    print(urls);
  });
});

 }
//First, you must retrieve your document, like this:
DocumentSnapshot firebaseDoc = await FirebaseFirestore.instance.collection('users').doc('yourDocumentId').get();

//then you need to extract your list, which is in the 'images' field, you can do so like this:
List<String> imagesList = firebaseDoc.data()['images'];

//Now, you have a list, containing the URLs you want.
print(imagesList[0]); //should print the first URL, you can take it from here