Bad state: field does not exist within the DocumentSnapshotPlatform in my flutter project

Viewed 30

I am building ecommerce application an exception caught in document snapshot in the given above question bad state and I don't know where the error after Also I have added listview but there was error occurs render overflow

In terminal i updated Flutter clean Flutter pub get

body: Column(
children: <Widget>[
  SizedBox(
    height: 10.0,
  ),
  Container(
    color: Color(0xffF7F7F7),
    child: StreamBuilder<QuerySnapshot>(
      stream: FirebaseFirestore.instance
          .collection("items")
          .where('seller', isEqualTo: parentIdGlobal)
          .where('isSold', isEqualTo: false)
          .snapshots(),
      builder: (context, snapshot) {
        if (!snapshot.hasData)
          return Center(
            child: CircularProgressIndicator(),
          );

        List<DocumentSnapshot> docs = snapshot.data.docs;

        if (docs.length == 0) {
          return Center(
            child: Padding(
              padding: const EdgeInsets.all(10.0),
              child: WebsafeSvg.asset(
                'assets/images/empty_dashboard.svg',
                fit: BoxFit.cover,
                height: MediaQuery.of(context).size.height / 5,
              ),
            ),
          );
        }
        return ListView(
          scrollDirection: Axis.vertical,
          shrinkWrap: true,
          children: docs.map((DocumentSnapshot doc) {
            bool isSold = doc['isSold'];
            bool isLiked = doc['isLiked'];
            String itemId = doc['itemId'];
            String seller = doc['seller'];
            String sellerName = doc['sellerName'];
            String title = doc['title'];
            String desc = doc['desc'];
            String price = doc['price'];
            String condition = doc['condition'];
            String category = doc['category'];
            String location = doc['location'];
            String itemImage = doc['imageDownloadUrl'];

            return SellerProductItem(
              itemId: itemId,
              seller: seller,
              sellerName: sellerName,
              title: title,
              desc: desc,
              price: price,
              itemImage: itemImage,
              isLiked: isLiked,
              isSold: isSold,
              category: category,
              condition: condition,
              location: location,
            );
          }).toList(),
        );
      },
);

I am trying to build listview to document

0 Answers
Related