appendPage method

void appendPage(
  1. List<ItemType> newItems,
  2. PageKeyType? nextPageKey
)

Appends newItems to the previously loaded ones and replaces the next page's key.

Implementation

void appendPage(List<ItemType> newItems, PageKeyType? nextPageKey) {
  final previousItems = value.itemList ?? [];
  final itemList = previousItems + newItems;
  value = PagingState<PageKeyType, ItemType>(
    itemList: itemList,
    error: null,
    nextPageKey: nextPageKey,
  );
}