如何在Flutter上获取Cloud Firestore上的文档ID

时间:2019-10-11 11:44:15

标签: firebase flutter dart

如何在Cloud Firestore上获取文档ID?

enter image description here

df
 .withColumn("a", whenBIsOneThen(0))
 .withColumn("c", whenBIsOneThen("Y"))

1 个答案:

答案 0 :(得分:0)

我尝试过这种方式。它正在工作。

  getCategoryId(String categoryName){
    var ref = _db.collection('categories')
        .where("categoryName",isEqualTo: categoryName).getDocuments();
    ref.then((v)=>print(v.documents[0].documentID));
}