I am having this issue on how to call the last message sent from the message Collection in firestore in flutter coupled with the image and username of the sender of the message from the user Collection and display those data to user Interface.
How do I call two firestore collection in flutter i.e the message collection and the user collection
Asked
Active
Viewed 46 times
1 Answers
0
Usually, in Firestore, you try to make read
operation easier.
Based on your requirements, you should probably store the display name and avatar of the sender within the message
document in Firestore.
This means that when you create a new message
, you need access to the user
to store this information.
This also means that if the user
changes her display name and/or avatar, you will have to modify all of her messages
in Firestore. This is usually done with a Cloud Function.

Thierry
- 7,775
- 2
- 15
- 33
-
Thanks a lot for your answers, please can you give an insight on how to carry in cloud function, something like and example that i can follow up.thanks in anticipation – matthew abbey Feb 04 '21 at 19:12
-
Have a look here for explanation about syncing denormalized data [https://youtu.be/77XmRDtOL7c?t=293]. By the way, the whole series about Get to know Firestore is really good. Check also this thread: https://stackoverflow.com/questions/53278365/firebase-cloud-functions-make-queries-on-collection – Thierry Feb 04 '21 at 21:43
-
Thanks a lot, it was really helpful – matthew abbey Feb 09 '21 at 16:16