如何在不使用 Flutter 擦除 Firestore 中的所有其他数据的情况下更新数据?

How to update data without wiping all other data in Firestore with Flutter?

我正在开发一个应用程序,我正在尝试将 bool 更新为 true,我试过 updateData() 但它只会擦除整个文档的字段,所以如果有人知道更好的方法,请..

您可以使用 setData() 函数代替 add() 方法。

void createRecord() async {
  await databaseReference.collection("books")
      .document("1")
      .setData({
        'title': 'Flutter',
        'description': 'Dart'
      },merge=true);// setData sets the data of a document, if it does not exists, then it creates a document with the specified name


}