0
votes

I get querySnapshot of a collection with Firestore and get List . To get a specific item in a List, it"s necessary to put the number in [], but I want to get a DocumentSnapshot for a specific DocumentId. Is there any way?

I tried indexOf, but it returns -1.

1

1 Answers

0
votes

You could do something like this:

snapshot.documents.firstWhere((doc) => doc.documentID == 'id', orElse: () => null)