mo_infinite_scroll 2.0.0
mo_infinite_scroll: ^2.0.0 copied to clipboard
Infinite scroll for Flutter with pull-to-refresh, pre-fetch, horizontal lists, error recovery, a Sliver variant, and customisable placeholders.
Changelog #
2.0.0 #
Added #
- Horizontal lists:
scrollDirectiononMoInfiniteScroll(pull-to-refresh is automatically disabled on the horizontal axis). reverse,shrinkWrap,pullToRefresh, andscrollControllerparameters onMoInfiniteScroll.- Load-more error recovery: when a page fails after items are already loaded, a compact retry row (
DefaultLoadMoreError, overridable viaerrorMoreIndicator) is shown at the end of the list instead of silently getting stuck. MoInfiniteScrollController.retry()— clears the error state and re-fetches the failed page.MoInfiniteScrollController.itemCountand a read-onlylastErrorgetter.- Single entry point:
import 'package:mo_infinite_scroll/mo_infinite_scroll.dart';now exports everything. - Widget tests covering placeholders, retry flows, pagination, horizontal scrolling, and the sliver variant.
Fixed #
- The default error placeholder's retry button did nothing (it called
fetchNextPage, which is a no-op while an error is pending). It now callsretry(). - Refresh race condition: calling
refresh()while a fetch was in flight could append stale results to the fresh list. Stale responses are now discarded. - Pull-to-refresh on short lists: physics now default to
AlwaysScrollableScrollPhysicswhen pull-to-refresh is active, and the empty state is scrollable so it can be pulled too. - Swapping the
controller,fetcher, orlimiton an existing widget is now handled correctly indidUpdateWidget. itemsno longer copies the whole list on every access (it is a read-only view), removing O(n²) work during builds.- Notifications after the controller is disposed no longer throw.
Changed (breaking) #
refresh()andfetchNextPage()no longer take(fetcher, limit)— the widget attaches them to the controller automatically. Callcontroller.attach(fetcher, limit)manually only when using a controller without a widget (e.g. in tests).- Implementation files moved to
lib/src/; import the package barrel instead of individual files. lastErroris now a read-only getter.- Removed the unused
MoInfiniteScrollStateenum.