Skip to content

Instantly share code, notes, and snippets.

@nanlabsweb
Created April 5, 2018 16:17
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 nanlabsweb/4ddf62e9f0ce18016b085d8e21504eba to your computer and use it in GitHub Desktop.
Save nanlabsweb/4ddf62e9f0ce18016b085d8e21504eba to your computer and use it in GitHub Desktop.
Get data from firestore.
fun getAllPets(): LiveData<List<Pet>> {
var pets: MutableLiveData<List<Pet>> = MutableLiveData()
firestoreDataBase.collection("pets").get().addOnSuccessListener {
pets.value = setPetsFromSnapshotIntoMutableList(it)
}
return pets
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment