Skip to content

Instantly share code, notes, and snippets.

@w9jds
Created May 17, 2018 04:45
Show Gist options
  • Save w9jds/9697b730a275fbdab294468a94f66fe3 to your computer and use it in GitHub Desktop.
Save w9jds/9697b730a275fbdab294468a94f66fe3 to your computer and use it in GitHub Desktop.
private val valueHandler = object: ValueEventListener {
override fun onDataChange(snapshot: DataSnapshot?) {
groups.value = snapshot?.children?.distinct() ?: emptyList()
loadFinished()
}
override fun onCancelled(error: DatabaseError?) {
groups.value = emptyList()
loadFinished()
}
}
firebase.getReference("types/$groupId").orderByChild("name").addListenerForSingleValueEvent(valueHandler)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment