Adding an Object to Cloud Firestore using Flutter

后端 未结 3 1076
余生分开走
余生分开走 2021-01-02 06:44

I want to add an object to Google Cloud Firestore in my Flutter app like this:

\"Firestore

I ha

3条回答
  •  被撕碎了的回忆
    2021-01-02 07:11

    You can run a Firestore transaction like this:

        Firestore.instance.runTransaction((transaction) async {
              await transaction.set(Firestore.instance.collection("your_collection").document(), {
                'replyName': replyName,
                'replyText': replyText,
                'replyVotes': replyVotes,
              });
            });
    

提交回复
热议问题