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
605 stars 201 forks source link

How to implement newPageErrorIndicatorBuilder? #331

Closed dbmessina closed 4 weeks ago

dbmessina commented 1 month ago

How would I go about implementing newPageErrorIndicatorBuilder? My guess was to call retryLastFailedRequest(), but this only causes the error message to be replaced by the loading spinner and there is no attempt made to fetch the data. I tried adding a call to _fetchPage() after this, and it works, but with issues. While the loading spinner is visible or when the fetch is complete (assuming it errors out again), if I scroll up a bit, the invisibleItemsThreshold is seemingly triggered and _fetchPage() is unexpectedly called again.

I don't have a problem with firstPageErrorIndicatorBuilder as I can seemingly just call refresh().

dbmessina commented 4 weeks ago

I was able to get this working okay on the example app (had to replace the defunct public API) and in a minimally reproducible code app. I've compared my actual code for the entire implementation with those and see no difference, so I'm not sure why it's not working. However, it's not a problem with the package, so closing this as a non-issue.