In order to save user credentials I use Firestore. In my app, I put an image picker only in the profile screen not in the authentication screen. I want the user to pick an image and upload it to Firebase storage after authenticating. Then the URL of the image taken from Firebase storage should be in Firestore.
How can I add a single ‘photoUrl’ key field and value after authentication? I want a patch request. It only adds the desired field.
I saw the update method, but it update the whole JSON data.
2
Answers
It sounds to me that you have used the set() function which:
However, if you have passed a SetOptions object as an argument, then:
If you need to simply update a document, you have to create an object of type
Map<Object, Object?>
and pass it to the update function.For this you need to know the document ID of the user and update the value with the update method of FirebaseFirestore.