Flutter中Cloud Firestore的FieldValue.increment [英] FieldValue.increment for Cloud Firestore in Flutter

查看:59
本文介绍了Flutter中Cloud Firestore的FieldValue.increment的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Flutter和Firebase Firestore创建一个Android应用. 我想添加新的FieldValue.increment功能,该功能自今年4月以来已在Firebase中提供,但是我遇到了一个错误: The method 'increment' isn't defined for the class 'FieldValue'.

I'm creating a android app using flutter and Firebase Firestore. I would like to add that new FieldValue.increment functionality which is apperently available in Firebase since this april but i've got an error: The method 'increment' isn't defined for the class 'FieldValue'.

这是我尝试过的代码:

onTap: (){
  Firestore.instance.document('docRef').updateData({"numberOfDocs": FieldValue.increment(1)});
}

我只是一个初学者,但是当我检查该field_value.dart文件时,它缺少增量"实现. 那么,说扑团队尚未实现该功能是正确的答案吗?

I'm just a beginner programmer but when i checked that field_value.dart file it's missing "increment" implementation. So, is it right answer to say that flutter team didn't yet implemented that functionality?

我看过一个教程,其中一些.js代码中已经使用了增量,但是对我来说它不起作用. https://www.youtube.com/watch?v=8Ejn1FLRRaw

I've seen a tutorial where increment is already used in some .js code but for me it's not working. https://www.youtube.com/watch?v=8Ejn1FLRRaw

推荐答案

据我在 FlutterFire的更改日志,尚未添加增量运算符.

As far as I can see in the change log for FlutterFire, the increment operator has not been added yet.

我向存储库添加了功能请求.

这篇关于Flutter中Cloud Firestore的FieldValue.increment的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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