【问题标题】:how can i call query with a notEqual (!=) where-clause using **Flutter** cloud_firestore plugin? [closed]如何使用 **Flutter** cloud_firestore 插件调用带有 notEqual (!=) where-clause 的查询? [关闭]
【发布时间】:2021-02-17 20:45:30
【问题描述】:

firebase 团队宣布 in this blog post 他们现在在 where 子句查询中支持 notEquals

我们如何在 Flutter 中调用这样的查询? 我在 pubspec.yaml 中使用latest version

cloud_firestore: ^0.14.2

例如,在 firebase 中,这现在(2020 年 10 月 1 日)是可能的:

collection("projects").where("status", "!=", "completed")

在颤振中它不起作用(位置参数太多):

    FirebaseFirestore.instance.collection("projects").where("status", "!=", "completed");

它没有命名参数,我能找到的唯一参数:

      Query where(
        dynamic field, {
        dynamic isEqualTo,
        dynamic isLessThan,
        dynamic isLessThanOrEqualTo,
        dynamic isGreaterThan,
        dynamic isGreaterThanOrEqualTo,
        dynamic arrayContains,
        List<dynamic> arrayContainsAny,
        List<dynamic> whereIn,
        bool isNull,
      })

有没有人有解决方法/想法/解决方案?

【问题讨论】:

  • 如果您是这个答案的反对者,您应该知道根据链接信息正在进行中。再次问这个问题不会改变你看到的事实。它仍在进行中。 stackoverflow.com/questions/64406005/…
  • 试图用这个确切的帖子来改善这个问题,它不允许,因为它已经关闭了,所以我打开了这个新的,你不支持的答案不是解决方案、想法或解决方法,虽然我认为这不是我要求的答案,但我删除了我的反对票,那部分是给定的

标签: firebase flutter google-cloud-firestore where-clause


【解决方案1】:

将此答案发布为社区 Wiki,因为 @DougSteveson 已经对此发表了评论,并在他分享的相关问题中发表了评论。

Firebase 在其最新版本中确实支持!=not-in 查询子句,您可以使用documentation 中的官方SDK 查看它的使用情况。

但是,Flutter Firestore 库尚未更新,因为这仍然是一个非常新的功能。目前,此功能的更新已合并,应该会出现在未来的版本中,如release notes 中所述。

【讨论】:

    猜你喜欢
    • 2022-01-21
    • 1970-01-01
    • 2019-04-30
    • 2011-11-21
    • 1970-01-01
    • 2018-06-21
    • 2019-03-05
    • 1970-01-01
    相关资源
    最近更新 更多