Flutter是否支持FieldPath? [英] Is FieldPath supported in Flutter?

查看:91
本文介绍了Flutter是否支持FieldPath?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I could not find FieldPath in the cloud_firestore Flutter plugin, however, I would assume that this is a very common tool that would be one of the first implementations for such a plugin.

FieldValue 是最近添加的,但是在 FieldPath 上找不到任何内容。

如果我想使用查询中> documentId ,有没有办法实现?

FieldValue was recently added, but I could not find anything on FieldPath.
If I wanted to use the documentId in a query currently, would there be a way to achieve this?

推荐答案

我实际上忘记了这一点,但是我添加了 FieldPath.documentId 作为在某个时候向 cloud_firestore 的拉出请求

I actually forgot about this, but I added FieldPath.documentId as part of a pull request to cloud_firestore at some point.

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

This means that you can simply use it like this:

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



过时



__ name __ 适用于,如果您想定位文档ID

Obsolent

__name__ works if you want to target the document id.

您可以将'__ name __'用作 String ,它等效于 FieldPath.documentId()

You can use '__name__' as a String, which is equivalent to FieldPath.documentId().

String fieldPathDocumentId = '__name__';

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

这篇关于Flutter是否支持FieldPath?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆