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

标签 flutter google-cloud-firestore flutter-web

查看 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/

相关文章:

javascript - Firebase 存储连接到 Angular 应用

在 PageView 中的 WheelEvent 上 Flutter Web "smooth scrolling"

flutter - flutter 缓存网页中的 webview 是否会发生?

Flutter SharedPreferences 值在应用程序启动时提供给 Provider

flutter - Flutter应用制作帐户并在手机之间发送数据

android - 每次从构建类中 flutter 停止底部导航栏

flutter - Google Play 商店是否容忍华为 HMS?

javascript - Google Cloud功能环境每个功能都超时

python - 将 for 循环与 firestore 数据迭代 API 请求结合使用时出现 JSONDecodeError

flutter - 在 Flutter 中,如何通过 checklisttile 使单个选项卡击键成为选项卡?