I need to get the data from a list in Firestore. I searched but don’t find any results for this, even in the Firebase Documents.
The list is a List of Strings. Let’s call him Users
.
The Users
list brings a list of names.
How can I get just the values from the Firestore?
The code I’m using is
firestoreClient.collection("Users").get().addOnSuccessListener { result -> }
What do I do inside the addOnSuccessListener
method?
I Already tried something like document.data
but don’t work for a list, because a list brings Any data type.
2
Answers
Try the following code.
Since you’re using Kotlin, the simplest method to read user documents would be to call get() and attach a listener. And in code, it would be as simple as: