Google cloud firestore firestore更新或添加成功状态

Google cloud firestore firestore更新或添加成功状态,google-cloud-firestore,Google Cloud Firestore,firestore中是否有状态来检查数据的添加或更新是否成功?我有以下代码: const result = await addFood(foodObj); if (result.status)? 然后将包含success响应,否则如果失败。将执行catch块 await ref.setData(data).then((doc) { print("doc save successful"); }).catchError((error) { p

firestore中是否有状态来检查数据的添加或更新是否成功?我有以下代码:

const result = await addFood(foodObj);

if (result.status)?

然后
将包含success响应,否则如果失败。将执行catch块

await ref.setData(data).then((doc) {
      print("doc save successful");
    }).catchError((error) {
      print("doc save error");
      print(error);
    });