next method

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

Fetches next page of the items.

Implementation

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

  if (pagination != null && nextLoading.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 && hasNext.isTrue; i++) {
      await pagination!.next();

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

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