show method

Future<void>? show({
  1. bool atTop = true,
})

Show the progress indicator and run the refresh callback as if it had been started interactively. If this method is called while the refresh callback is running, it quietly does nothing.

Creating the LiquidPullToRefresh with a GlobalKey<LiquidPullToRefreshState> makes it possible to refer to the LiquidPullToRefreshState.

The future returned from this method completes when the LiquidPullToRefresh.onRefresh callback's future completes.

If you await the future returned by this function from a State, you should check that the state is still mounted before calling setState.

When initiated in this manner, the progress indicator is independent of any actual scroll view. It defaults to showing the indicator at the top. To show it at the bottom, set atTop to false.

Implementation

Future<void>? show({bool atTop = true}) {
  if (_mode != _LiquidPullToRefreshMode.refresh &&
      _mode != _LiquidPullToRefreshMode.snap) {
    if (_mode == null) _start(atTop ? AxisDirection.down : AxisDirection.up);
    _show();
  }
  return _pendingRefreshFuture;
}