I am retreiving a list from Firestore and I need to use query where to retrieve specific UserID but at the same time I need also to order this list by the timestamp. Using orderBy and where is not possible to get this is my code:
Container(
height: MediaQuery.of(context).size.height * 0.275,
child: StreamBuilder(
stream: FirebaseFirestore.instance
.collection('ConfirmedCart').orderBy('cartDate',descending: false)
.where('idConsultant', isEqualTo: firebaseUser.uid)
.snapshots(),
builder: (context, snapshotConfirmedCart) {
if (!snapshotConfirmedCart.hasData)
return Container(
width: 40,
child: Center(
child: CircularProgressIndicator(
backgroundColor: Colors.orange,
),
));
as you can see above orderBy is used and can't fetch data, If I removed orderBy, I get the data but without my specific order.