2

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 Answer 1

0

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
    }
Sign up to request clarification or add additional context in comments.

3 Comments

Does not make any difference.
what does it change by implementing this way?
Yes, when you use it with Future then you would see the change.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.