Skip to content

Add coroutines Flow extension functions for Firestore #1251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
martinbonnin opened this issue Feb 17, 2020 · 4 comments
Closed

Add coroutines Flow extension functions for Firestore #1251

martinbonnin opened this issue Feb 17, 2020 · 4 comments
Labels
type: feature request New feature or request

Comments

@martinbonnin
Copy link
Contributor

martinbonnin commented Feb 17, 2020

What feature would you like to see?

Firestore has DocumentReference.addSnapshotListener and Query.addSnapshotListener.

Both of these are callback based and it would be nice to have coroutines equivalents. Something like:

fun DocumentReference.toFlow(): Flow<DocumentSnapShot> { 
      TODO()
}

fun Query.toFlow(): Flow<QuerySnapShot> { 
      TODO()
}

How would you use it?

This would be useful to leverage coroutines to make the code look nicer. Also it can be used together with coroutines scopes to bind Firestore queries to the Android lifecycle.

@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@aguatno aguatno added type: feature request New feature or request and removed needs-triage labels Feb 17, 2020
@aguatno
Copy link

aguatno commented Feb 17, 2020

Thank you for sending this feature request. We will keep this FR open and update it as we prioritize new features. Thank you.

@svenjacobs
Copy link

Also looking forward to this! I'm using my own implementations of toFlow() for DocumentReference and Query but would really like to use some official solution :)

@vkryachko
Copy link
Member

This was added in firebase-firestore-ktx version 24.3.0

@firebase firebase locked and limited conversation to collaborators Oct 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature request New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants