previous method

  1. @override
Future<void> previous()
override

Fetches previous page of the items.

Implementation

@override
Future<void> previous() async {
  Log.debug('previous()', '$runtimeType');

  if (pagination != null && previousLoading.isFalse) {
    if (status.value.isSuccess) {
      status.value = RxStatus.loadingMore();
    }

    // TODO: Probably shouldn't do that in the store.
    int length = items.length;
    for (int i = 0; i < 10 && hasPrevious.isTrue; i++) {
      await pagination!.previous();

      if (length != items.length || hasPrevious.isFalse) {
        break;
      }
    }

    status.value = RxStatus.success();
  }
}