Null affecting Map<String, dynamic>

31 Views Asked by At
child: StreamBuilder<QuerySnapshot>(
    stream: _address,

    builder: ( BuildContext context, AsyncSnapshot<dynamic> snapshot) {
      print(snapshot);
      if (snapshot.connectionState == ConnectionState.done && snapshot.hasData && 
        snapshot.data != null) {
        !snapshot.hasData;
        return Center(
          child: circularProgress(),
        );
      } else {
        return snapshot.data?.docs.length == 0 ?
        Container() : ListView.builder(
            itemCount: snapshot.data?.docs.length,
            shrinkWrap: true,
            itemBuilder: (context, index) {
              return AddressDesign(
                currentIndex: address.count,
                value: index,
                addressID: widget.addressID,
                totalAmount: widget.totalAmount!,
                clientUID: widget.clientUID!,
                  model: Address.fromJson(

                  snapshot.data?.docs[index].data()! as Map<String, dynamic>
              ),
              );
            });
      }

    },),);

enter image description here

I have tried removing Null safety from the Model class but it only made it worse. What i would like to know is how can i display data on the page without it returning a null value. Please i need help!

0

There are 0 best solutions below