Dart 获取Flatter中Cloud Firestore文档的路径
在这样的情况下,我在云Firestore集合中迭代文档,如何获得文档的路径Dart 获取Flatter中Cloud Firestore文档的路径,dart,flutter,Dart,Flutter,在这样的情况下,我在云Firestore集合中迭代文档,如何获得文档的路径 children: snapshot.data.documents.map((document) { return new ListTile( //want to get the document path here title: new Text(document.path), ); 显然,您可以访问路径数据,但我在github上找到的解释非常不清楚 查看源代码: 在中,您可以看到\u pat
children: snapshot.data.documents.map((document) {
return new ListTile(
//want to get the document path here
title: new Text(document.path),
);
显然,您可以访问路径数据,但我在github上找到的解释非常不清楚
查看源代码:
在中,您可以看到\u path
是文档快照的私有属性
此外,您可以看到路径可以在文档参考中访问
这将产生以下代码:
children: snapshot.data.documents.map((document) {
return new ListTile(
title: new Text(document.reference.path), // this will return the path
);
注意,我只是添加了.reference