Skip to content
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

Async way to getData from Firestore #135

Closed
jarroyoesp opened this issue Mar 19, 2020 · 2 comments
Closed

Async way to getData from Firestore #135

jarroyoesp opened this issue Mar 19, 2020 · 2 comments

Comments

@jarroyoesp
Copy link

Hi, first of all thank you for this library!

But I have a question, is there any way to get data from Firestore without callbacks? Are you thinking to develop it?

getFirebaseInstance()
                .collection("sponsors-sf-2019")
                .orderBy("displayOrder")
                .get_()
                .addListeners(...)
@kpgalligan
Copy link
Contributor

Like a direct call or coroutines? You can use coroutines to call get_().

https://github.com/touchlab/FirestoreKMP/blob/master/firestore/src/commonMain/kotlin/co/touchlab/firebase/firestore/Query.kt#L36

getFirebaseInstance()
.collection("sponsors-sf-2019")
.orderBy("displayOrder")
.suspendGet()

That's a suspend method, so it needs to be inside a coroutine, but will work.

@jarroyoesp
Copy link
Author

Hi @kpgalligan, "SuspendGet()" is what I need! Thank you for your quick response! 👏🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants