So am having a scroll listener where am calling the function to get data but after getting data i need to hot restart to see changes. and is it like that set state rebuilds the main widget but not any sub widget like i made a widget xyz which is of container type and placed this in main widget so will it rebuild xyz also?
listener:-
void _scrollListener()async{
if (!loading&&!load) {
if (scrollController.position.pixels == scrollController.position.maxScrollExtent) {
setState(() => load = true);
await clearEmptyDocs();
getMoreData();
}
}
}
function:-
getMoreData()async
{
var quicks;
var posts;
if(publicPostsDocuments.isNotEmpty)
{
print('1
');
posts=await getPublicPosts();
}
else
{
print('2
');
posts=await getPublicDocuments();
}
if(publicQuicksDocuments.isNotEmpty)
{
print('3
');
quicks=await getPublicQuicks();
}
else
{
print('4
');
quicks=await getPublicDocumentsForQuicks();
}
List<GridTile> newGridTile=[];
posts.forEach((eachPost) {newGridTile.add(GridTile(
child: ClipRRect(
borderRadius: BorderRadius.circular(10),
child: PostTile(eachPost,posts: postList,)
),
));});
quicks.forEach((eachPost) {newGridTile.add(GridTile(
child: ClipRRect(
borderRadius: BorderRadius.circular(10),
child: PostTile(eachPost,posts: quicksList,isFromSearch: true,),
),
));});
newGridTile.shuffle();
gridTile.addAll(newGridTile); //am using this gridtile list to show elements
setState(() {
load=false;
});
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…