I have a collection company and each company has a collection employee. I want to create a query to retrieve a particular employee based on its document id. Do you have any idea how to do that?
I was thinking about using collectionGroup("employee"), but I couldn't find a way to access the document id.
Stream<UserModel> streamFirestoreUser() {
return _db
.collectionGroup('employee')
.where("email", isEqualTo: emailController.text)
.limit(1)
.snapshots()
.map((event) => UserModel.fromJson(event.docs.first.data()));
}