where子句在Firestore抖动中不起作用

时间:2020-10-22 21:33:35

标签: flutter google-cloud-firestore

我试图在flutter中使用where子句,但是尽管Firestore中有数据,但它返回null。这是我的代码:

  Future<List<DocumentSnapshot>> fetchInitialBatch() async {
    return (await Firestore.instance
            .collection("videos")
            .where("category", isEqualTo: category)
            .orderBy("url")
            .limit(3)
            .getDocuments())
        .documents;
  }

这是firestore的屏幕截图:image link

其中缺少什么?

1 个答案:

答案 0 :(得分:1)

首先确保该字段没有空格或不必要的字符弄乱查询。其次,尝试颠倒该语句的顺序,看看它是否可以像下面那样工作。

您甚至可以删除每个字段,然后再次创建它们以查看是否可以使用。除此之外,我看不到您做错了什么,对我而言,更像是从字段中的Firebase本身读取空白。

  Future<List<DocumentSnapshot>> fetchInitialBatch() async {
   return (awaitFirestore.instance.collection("videos")
   .orderBy('url').limit(3).where("category",isEqualTo: category).
   getDocuments()).documents;
  }
相关问题