Infinite Scroll Listview - Setstate() Or Markneedsbuild Called During Build
I'm Creating an infinite scroll listView and i want to change the _loadingState String from 'loading...' to 'loaded' using setState in the _loadNames function, but when _loadNames
Solution 1:
Change _loadNames() {
to
_loadNames(){
loading = true;
// setState(() {
_loadingState = 'loading...';
// });
and
onRefresh: (){
_loadNames();
returnnull;
},
to
onRefresh: (){
setState(() =>_loadNames());
},
update
_loadNames(){
loading = true;
newFuture.delayed(Duration.zero, () =>setState(() {
_loadingState = 'loading...';
}));
Post a Comment for "Infinite Scroll Listview - Setstate() Or Markneedsbuild Called During Build"