refresh method

Future<void> refresh([
  1. bool showRefreshIndicator = true
])

Show the refresh indicator and call the DataGridSource.handleRefresh.

To access this method, create the SfDataGrid with a GlobalKey<SfDataGridState>.

The future returned from this method completes when the DataGridSource.handleRefresh method’s future completes.

By default, if you call this method without any parameter, RefreshIndicator will be shown. If you want to disable the RefreshIndicator and call the DataGridSource.handleRefresh method alone, pass the parameter as false.

Implementation

Future<void> refresh([bool showRefreshIndicator = true]) async {
  if (_dataGridConfiguration.allowPullToRefresh &&
      _dataGridConfiguration.refreshIndicatorKey != null) {
    if (showRefreshIndicator) {
      await _dataGridConfiguration.refreshIndicatorKey!.currentState?.show();
    } else {
      await _dataGridConfiguration.source.handleRefresh();
    }
  }
}