【问题标题】:How do I make this hardcoded Flutter Firestore query where clause variable dynamic?如何使这个硬编码的 Flutter Firestore 查询 where 子句变量动态化?
【发布时间】:2023-01-08 02:43:59
【问题描述】:

我没有运气地尝试创建变量列表并将其分配给 where 子句。怎么做?

我在尝试中遇到的错误是

不能将参数类型“Future<List<String>> Function({dynamic userId})”分配给参数类型“List<Object>”

我期待过滤效果。

【问题讨论】:

  • 请使用可用的工具和格式来共享代码,不鼓励代码截图
  • 请提供足够的代码,以便其他人可以更好地理解或重现问题。

标签: flutter firebase


【解决方案1】:

尝试使用异步等待构造。 将您的 getOtherActivitiesList 声明为异步。 然后在返回 _firebaseFirestore 之前插入: 列表 sList = await choosenList(userId) 并将硬编码列表替换为动态 .where('activityId', whereIn: sList)

【讨论】:

    猜你喜欢
    • 2021-09-12
    • 1970-01-01
    • 1970-01-01
    • 2015-11-11
    • 2021-01-07
    • 2019-08-08
    • 2019-05-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多