How to access RefreshIndicatorState of RefreshIndicator?

2,578

See https://docs.flutter.io/flutter/material/RefreshIndicatorState/show.html and a usage example in the Flutter Gallery

Essentially

var indicator = new GlobalKey<RefreshIndicatorState>();

and then

indicator.currentState.show();

after it's built.

Share:
2,578
Duncan Jones
Author by

Duncan Jones

Updated on December 04, 2022

Comments

  • Duncan Jones
    Duncan Jones over 1 year

    The docs for RefreshIndicator suggest you can programmatically trigger the refresh behaviour via the RefreshIndicatorState class.

    How do I access an instance of this class, assuming I've added a RefreshIndicator widget to my application? I can't see a property to access it and I'm assuming createState() is only used by the Flutter framework.

    To avoid an XY problem, I should explain my reason for doing this is to perform a visually pleasing refresh of my list when my user first opens the app. The list will be empty initially and the refresh will poll my server for data.