im using streambuilder, and i want the data 'order by' and 'where' at the same time. cause everytime im using both of the query my list doesn'show up, but when im using only 1 query the list show up
here my streambuilder
StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance.collection("clothes")
.where('clothesCloset',
isEqualTo: closet.closetId)
.snapshots(),
builder: (BuildContext context,
AsyncSnapshot<QuerySnapshot> snapshot) {
if (snapshot.hasError) {
return Text("Failed to load data!");
}
switch (snapshot.connectionState) {
case ConnectionState.waiting:
return ActivityServices.loadings();
default:
return new GridView(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, //two columns
mainAxisSpacing: 0.1, //space the card
childAspectRatio: 0.800,
),
children: snapshot.data.docs
.map((DocumentSnapshot doc) {
Clothes clothes;
clothes = new Clothes(
doc.data()['clothesId'],
doc.data()['clothesName'],
doc.data()['clothesDesc'],
doc.data()['clothesImage'],
doc.data()['clothesCloset'],
doc.data()['clothesAddBy'],
doc.data()['clothesAge'],
doc.data()['clothesTag'],
doc.data()['clothesStatus'],
doc.data()['clothesLaundry'],
doc.data()['createdAt'],
doc.data()['updatedAt'],
);
return CardClothesLemari(clothes: clothes);
}).toList(),
);
}
},
)