Refresh indicator sometime did not perform the action

Viewed 47

I have one refresh indicator in which I print something. When I drag the refresh indicator sometimes it prints the statement but sometimes I drag the refresh indicator it just moves up quickly and does not perform anything. I do not know why this strange behavior or what I am missing.

RefreshIndicator(
                  onRefresh: () async {
                      print("I am refresshing the data");
                      await some APi call
                    };
child:Listview.builder();
                 
1 Answers

Create a function and pass it to onRefresh. And In that function, you should perform your task.

onRefresh: refreshList 

 Future<Null> refreshList() async{
      await Apicall();
    }
    
    Apicall(){
    //write api call
    }
Related