EdsonBueno / infinite_scroll_pagination

Flutter package to help you lazily load and display pages of items as the user scrolls down your screen.
https://pub.dev/packages/infinite_scroll_pagination
MIT License
623 stars 210 forks source link

Question: What does pageKey exactly do? #218

Closed Shawn-sudo closed 1 year ago

Shawn-sudo commented 2 years ago

Hi, I'm just wondering what pageKey exactly do in .addPageRequestListener((pageKey) {}) and .appendPage([items_here], nextPageKey).

README only shows how to use it (like when appending a page, nextPageKey = pageKey + newItems.length), and everything seems to work fine even when I just put any random number for pageKey and nextPageKey, so what do they do?

clragon commented 2 years ago

pageKey tells you which page you are on. this can be anything from a number going up to a string that tells the database cursor where it is. putting random numbers into it doesnt really make any sense, because you lose orientation in your pagination.