gpt4 book ai didi

flutter - SetOptions 在 Firestore Flutter WEB 中不起作用

转载 作者:行者123 更新时间:2023-12-05 08:18:37 25 4
gpt4 key购买 nike

查看 Flutter Web。似乎 Firestore Flutter Web 集成还不完善。试图传递 {merge: true} 参数:

webFirestore
.collection("/users")
.doc(uid)
.set(map, {merge: true});

{merge: true} 带有红线下划线。尝试了不同的格式,都没有用。有谁知道语法应该是什么样子?

这就是 firestore 文档所说的:

/// An object to configure the [WriteBatch.set] behavior.
/// Pass [: {merge: true} :] to only replace the values specified in
/// the data argument. Fields omitted will remain untouched.
@anonymous
@JS()
abstract class SetOptions {
/// Set to true to replace only the values from the new data.
/// Fields omitted will remain untouched.
external bool get merge;
external set merge(bool v);
external factory SetOptions({bool merge});
}

最佳答案

遇到了同样的问题,我相信这是可行的:

webFirestore
.collection("/users")
.doc(uid)
.set(map, SetOptions(merge: true));

关于flutter - SetOptions 在 Firestore Flutter WEB 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59344201/

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