setLastStatusAsCurrent method

void setLastStatusAsCurrent({
  1. required Future<void> ifLastIsLoading(),
})

Restores the last status before network error as the current status.

If the last status was PagifyAsyncCallStatus.loading, the provided ifLastIsLoading callback will be invoked.

Implementation

void setLastStatusAsCurrent({
  required Future<void> Function() ifLastIsLoading,
}) {
  if (lastStateBeforeNetworkError == PagifyAsyncCallStatus.loading) {
    ifLastIsLoading.call();
  } else {
    updateStatus(lastStateBeforeNetworkError);
  }
}