skip to Main Content

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?

2

Answers


  1. Chosen as BEST ANSWER

    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()
    

  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search