Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dart 获取Flatter中Cloud Firestore文档的路径_Dart_Flutter - Fatal编程技术网

Dart 获取Flatter中Cloud 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

在这样的情况下,我在云Firestore集合中迭代文档,如何获得文档的路径

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