Open rsegecin opened 2 months ago
The PR mostly went under because the repository was not actively maintained at the time. Generally I am unsure if this functionality should be part of the library. It can easily be added via extensions from the outside, when required.
hi @clragon, thank you for your reply. I've forgot about this issue as I had found this extension but definitely it would be a nice to have it embedded it in the package.
for anyone looking for it.
extension PrependPageExtension<PageKeyType, ItemType>
on PagingController<PageKeyType, ItemType> {
/// Prepends [newItems] to the previously loaded ones
void prependPage(List<ItemType> newItems) {
final previousItems = value.itemList ?? [];
final itemList = newItems + previousItems;
value = PagingState<PageKeyType, ItemType>(
itemList: itemList,
error: null,
nextPageKey: nextPageKey,
);
}
}
There was an attempt to merge #258 to add the prepend functionality to the scrollcontroller, why wasn't it merged? and btw the beers api from punkapi is not online.