Skip to content

Instantly share code, notes, and snippets.

@ankurg22
Created January 18, 2022 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ankurg22/014723d7675499ededa9f2f492bac52d to your computer and use it in GitHub Desktop.
Save ankurg22/014723d7675499ededa9f2f492bac52d to your computer and use it in GitHub Desktop.
fun getMessages(...): Flow<List<DocumentChange>> {
return callbackFlow {
...
.addSnapshotListener { snapshot, e ->
if(e != null) close(e)
trySend(snapshot.documentChanges)
}
awaitClose()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment