Last active
December 21, 2019 16:41
-
-
Save gastsail/8f43f1dda56a06ef9a1804bd267b974a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
suspend fun getEventsDB(): Resource<MutableList<Event>>{ | |
val myList = mutableListOf<Event>() | |
val eventList = FirebaseFirestore.getInstance().collection("events").get().await() | |
// we can do wathever we want with the events, for example get them all | |
for (document in eventList) { | |
val photoUrl = document.getString("photoUrl") | |
val eventName = document.getString("name") | |
val time = document.getString("time") | |
myList.add(Event(photoUrl!!, eventName!!, time!!)) | |
} | |
return Resource.Success(myList) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment