retry method

Future<void> retry()

Retry any failed load requests.

Unlike refresh, this does not resets the whole value, it only retries the last failed load request.

Implementation

Future<void> retry() {
  final lastValue = value.asSuccess;
  assert(lastValue.hasError, '');

  final nextPageKey = lastValue.nextPageKey;
  // resetting the error
  value = lastValue.copyWith(error: null);
  // ignore: null_check_on_nullable_type_parameter
  return loadMore(nextPageKey!);
}