2

I have been trying to get the value merchant_ID from a map inside a List, but I couldn't. please how to query this in flutter?

List<Order?> fetchOrder(QuerySnapshot querySnapshot) {
    
    return querySnapshot.docs.map((order) {
        return Order.fromFirebase(order);
    }).toList();

  }

  Stream<List<Order?>> get Orders {
    return collectionOrd.where("products.merchant",isEqualTo: userID).snapshots().map(fetchOrder);
  }

enter image description here

zahreddine
  • 65
  • 5
  • It's not possible to query for nested map fields inside an array. You will need to restructure your data, or query the entire collection and filter in your app code. – Doug Stevenson Sep 01 '22 at 14:58

0 Answers0