如何使用 graphql 从 Firebase 使用 Flutter 从 Cloud Firestore 获取数据?

Posted

技术标签:

【中文标题】如何使用 graphql 从 Firebase 使用 Flutter 从 Cloud Firestore 获取数据?【英文标题】:How to use graphql to get data from Cloud Firestore from Firebase using flutter? 【发布时间】:2020-05-01 21:58:44 【问题描述】:

是否可以使用 graphql 在 Flutter 中查询 Firestore firebase 的结果。 我必须缩小一些结果的范围,并将它们带到前端。 请帮我解决这个问题。 提前致谢

【问题讨论】:

【参考方案1】:

是的,您可以将 GraphQL 与 Firestore 一起使用,实际上 this other thread 对此进行了更深入的探索。

总结这些信息,您首先需要将 Firestore 中的结果(例如通过 .get 方法获得的结果)转换为数组,以便将它们传递给 GraphQL。

网上也有一些这样的例子,比如this git repository。您可以使用这些作为指南来设置您自己的实现。

希望你觉得这很有用。

【讨论】:

以上是关于如何使用 graphql 从 Firebase 使用 Flutter 从 Cloud Firestore 获取数据?的主要内容,如果未能解决你的问题,请参考以下文章