enhanced_pagination_view 1.3.0
enhanced_pagination_view: ^1.3.0 copied to clipboard
Powerful pagination package with O(1) item updates, dual mode support (infinite scroll + pagination buttons), and comprehensive state management.
1.3.0 - 2025-12-25 #
Added #
- Manual pagination control via
PageResult<T>(#5)- New
PageResult<T>class allows manual control over pagination end detection - Useful when API provides
hasNextPageflag or last page has exactlypageSizeitems - Backward compatible: existing code using
List<T>return type continues to work with automatic detection pageFetchercan now return eitherList<T>(automatic) orPageResult<T>(manual)
- New
Examples #
- Added
manual_control_example.dartdemonstrating both manual and automatic pagination control
Tests #
- Added comprehensive tests for
PageResultmanual control including issue #5 scenario
1.2.3 - 2025-12-23 #
Fixed #
- Trim-compensation fail-safe: Prevents "Duplicate GlobalKey detected" crashes by automatically disabling
compensateForTrimmedItemswhenitemKeyGetterproduces duplicate or empty keys. - Separator + empty list: Prevents crashes when using
separatorBuilderwith an empty list by ensuringchildCountis0whenitems.isEmpty.
Tests #
- Added widget regression tests for duplicate/empty keys with trim compensation and separator + empty list scenarios.
1.2.2 - 2025-12-23 #
Documentation #
- Rewrote README in a more beginner-friendly tone and added clearer explanations/examples.
- Added a clickable LICENSE link in README.
Fixed #
- Long scroll “jump/overscroll”: Added safer infinite-scroll trigger guards (clamped scroll percentage,
hasClientschecks, andmaxScrollExtentedge case handling). - Next-page retry:
retry()now correctly retries the next page when an error occurs after items already exist.
Improved #
- Default caching:
PagingConfig.cacheModedefault changed toCacheMode.allto avoid scroll-position jumps caused by head trimming. - Optional scroll stabilization: Added
PagingConfig.compensateForTrimmedItemsto best-effort compensate for head trimming (requiresPagingController.itemKeyGetter). - Logging: Removed internal error
debugPrintcalls; apps should use controller state / analytics hooks to log.
Tests #
- Added long-scroll stability tests (List/Grid/Wrap) and expanded widget coverage for real-life flows (empty, error/retry, completed, pagination buttons, refresh).
1.2.1 - 2025-12-22 #
Fixed #
- Grid and Wrap layouts: Fixed
_buildSliverListmethod to properly handle grid and wrap layout modes- Grid layout now correctly uses
SliverGridwith the providedgridDelegate - Wrap layout now properly wraps items using
SliverToBoxAdapterwithWrapwidget - Both vertical and horizontal scroll directions now work correctly for grid layouts
- Grid layout now correctly uses
Documentation #
- Added comprehensive layout examples to README with List, Grid, and Wrap configurations
- Added layouts example to the demo app showcase
- Updated feature list to highlight multiple layout support
1.2.0 - 2025-12-20 #
⚡ Developer Experience Improvements #
Breaking Change
itemKeyGetteris now optional: No longer required for basic pagination use cases- Only needed when using
updateItem()orremoveItem(key: ...) - Basic pagination (load, refresh, append, insert) works without it
- Clear error messages guide developers when key-based operations require
itemKeyGetter
- Only needed when using
Added
PagingController.simple()factory constructor for beginner-friendly usage- Helpful error messages when attempting key-based operations without
itemKeyGetter - Better parameter documentation with clear descriptions and examples
Improved
- Simplified all examples to remove unnecessary
itemKeyGetterusage - Updated README with clear "Simple" vs "Advanced" usage patterns
- Parameter documentation now explains when each feature is needed
- All configuration parameters have improved descriptions
Migration Guide
No migration needed! This is a backward-compatible breaking change:
- Existing code with
itemKeyGettercontinues to work exactly the same - New code can omit
itemKeyGetterfor simpler usage - Key-based
updateItem()andremoveItem()still requireitemKeyGetter
1.1.0 - 2025-12-19 #
Improved #
- Concurrency safety: stale in-flight page results are ignored after
refresh()/restore.
1.0.0 - 2025-12-19 #
🎉 Initial Release #
Changed #
- Default
PagingConfig.cacheModeisCacheMode.limited(defaultmaxCachedItemsstays 500) to prevent unbounded memory growth in infinite scroll.
Improved #
PagingControllerkeeps its internal item list growable (safer when fetchers return fixed-length lists).PagingController.loadNextPage()updates the key→index map incrementally when possible; rebuilds only when cache trimming shifts indices.
Fixed #
- Example: SnackBars replace the previous one immediately and reliably auto-dismiss.
- Example: Replaced deprecated
withOpacityusage.
Features
- ✅ Dual Mode Support: Infinite scroll or pagination buttons
- ✅ O(1) Item Updates: Direct item manipulation using key-based lookup
- ✅ Comprehensive State Management: 7 states (initial, loading, loaded, loadingMore, error, empty, completed)
- ✅ Item Management Methods:
updateItem(): Update single item without refreshremoveItem(): Remove item from listinsertItem(): Insert at specific positionappendItem(): Add to end of list
- ✅ Pull-to-Refresh: Built-in refresh functionality
- ✅ Error Handling: Automatic retry mechanism with custom error widgets
- ✅ Customizable UI: Custom loaders, empty states, pagination controls
- ✅ Type Safe: Full generic type support
- ✅ Performance Optimized: Map-based tracking for O(1) lookups
- ✅ Well Documented: Comprehensive comments and README
Why This Package?
Solves major limitations of pagination_view:
- No direct item access ❌ → Direct access ✅
- No item updates ❌ → O(1) updates ✅
- Limited state management ❌ → 7 states ✅
- No pagination mode ❌ → Dual mode ✅
Technical Details
- Minimum Flutter SDK: 3.0.0
- Dart SDK: >=3.0.0 <4.0.0
- Zero external dependencies (except Flutter)
- Null-safe
- Well-tested
Credits #
Built with ❤️ to solve real-world pagination challenges in Flutter apps.