I have a Firestore collection I am querying and referencing another document that I have already queried prior (teamRecord). In this case everything is working up to the final 'user_inchallenge' call. In this case, the user_inchallenge is a DocumentReference and the teamRecord.usersInTeam is a List of DocumentReferences. However, there whereIn call does not seem to be working properly. I only want to return docs where user_inchallenge is held within teamRecord.usersInTeam.
FirebaseFirestore
.instance
.collection('activity_units')
.orderBy('activity_value', descending: true)
.where('challenge_reference', isEqualTo: challenges.reference)
//below is not working
.where('user_inchallenge', whereIn: teamRecord.usersInTeam.asList())
As a note, if I remove the .asList() call in usersInTeam I get the error:
The argument type 'BuiltList<DocumentReference>' can't be assigned to the parameter type 'List'.
I also tried isEqualTo, arrayContains, but none of them have returns the filtered results.