I have a collection 'posts' which has documents as uid of the particular users, under each document I have array 'posts' which contains a string 'likes' and a map 'post' which again contain a string 'userpost'.
I need to show data of the 'userpost' as a list in my homepage. Can someone suggest me a query for this.
I tried this:
return Firestore.instance.collection('posts').where('posts', arrayContains: 'post').snapshot();
And in my home page under listview.builder I'm retrieving data like this:-
Text( snapshot.data.documents[i].data['userpost'], )
But after running It isn't showing anything in the homepage and an execption is thrown: A build function returned null.
Firestore QuerySnapshot which you have to loop over to get the actual document map
Should try this