How To Set A GirdView Hight To Wrap Its Contant - Flutter Web

In my flutter web app i have gird which shows the mentors it fetchesthe data from firebase firestore but the gidviews shows error

RenderFlex children have non-zero flex but incoming height constraints are unbounded.

I have tired to wrap it in a expanded widget but did not work and when i wrap the gridview in sizedbox and set its height its works fine, but i want the height should be dynamic based on the items in the girdview.

The girdview is inside a listview.

This is my code

              stream: FirebaseFirestore.instance
              builder: (BuildContext context,
                  AsyncSnapshot<QuerySnapshot> snapshot) {
                if (!snapshot.hasData) {
                  return Center(
                    child: ProgressBar(loading: true),
                } else {
                  return GridView.count(
                    crossAxisCount: 4,
                    childAspectRatio: 0.8,
                    children: {
                      return ConsultantCard(
                        name: documents['name'],
                        profession: documents['profession'],
                        shortDesc: documents['shortDesc'],
                        countryCode: documents['countryCode'],
                        imageUrl: documents['imageUrl'],
                        rating: documents['rating'],
                        ratingsNum: documents['ratingsNum'],
                        fees: documents['fees'],
                        verified: documents['verified'],
                        popular: documents['popular'],
                        freeTrial: documents['freeTrial'],
                        languages: documents['languages'],


shrinkWrap: true This is what you need inside your gridView