Ask Your Question
3

In Flutter, what is the method to use for updating information in Firestore?

asked 2022-01-12 11:00:00 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-09-24 14:00:00 +0000

djk gravatar image

To update information in Firestore, you can use the update method provided by the DocumentReference class in the package:cloud_firestore package. The update method takes a Map parameter that contains the keys and values of the fields you want to update. For example:

FirebaseFirestore.instance
    .collection('users')
    .doc('abc123')
    .update({'name': 'John Doe', 'age': 30});

This code updates the name and age fields of the document with ID abc123 in the users collection.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-01-12 11:00:00 +0000

Seen: 16 times

Last updated: Sep 24 '22