I was working on an application where I needed real-time updates on a list of documents (using their document-id ) in firebase using kotlin flows. How can I achieve that?
CodePudding user response:
To view a list of documents in real time, use Firestore snapshot listener.
Check the link for more - https://firebase.google.com/docs/firestore/query-data/listen
CodePudding user response:
To get updates in real-time on the list of documents, we can use queries.
like in this case, we can use whereIn
val listOfDocumentIds = getDocumentIdsList()
val listDocumentsFlow: Flow<QuerySnapshot> = collectionUserDetails.whereIn(FieldPath.documentId(),listOfDocumentIds).snapshots()