gpt4 book ai didi

firebase - Flutter 支持 FieldPath 吗?

转载 作者:IT王子 更新时间:2023-10-29 06:49:44 26 4
gpt4 key购买 nike

我在 cloud_firestore Flutter plugin 中找不到 FieldPath , 但是,我认为这是一个非常常见的工具,将是此类插件的首批实现之一。

FieldValue是最近添加的,但我在 FieldPath 上找不到任何内容。
如果我想在当前的查询中使用documentId,是否有办法实现这一点?

最佳答案

我实际上忘记了这个,但我添加了 FieldPath.documentId作为 a pull request 的一部分在某个时候到 cloud_firestore

这意味着您可以像这样简单地使用它:

Firestore.instance.collection('movies').orderBy('rating').orderBy(FieldPath.documentId);

过时

__name__ works 如果您想定位文档 ID

您可以将'__name__'用作String,相当于FieldPath.documentId() .

String fieldPathDocumentId = '__name__';

Firestore.instance.collection('movies').orderBy('rating').orderBy(fieldPathDocumentId);

关于firebase - Flutter 支持 FieldPath 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52468310/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com