cursor_pagination 1.0.0
cursor_pagination: ^1.0.0 copied to clipboard
A flexible cursor-based pagination library for Flutter with full generic type support. Works with ChangeNotifier, BLoC/Cubit, and supports any cursor type.
1.0.0 #
Initial Release ๐ #
- โจ Full generic type support for cursors (String, int, DateTime, custom types)
- ๐ Two controller implementations:
FlutterPaginationControllerfor ChangeNotifier-based appsCubitPaginationControllerfor BLoC/Cubit pattern
- ๐ Auto-loading pagination on scroll
- ๐จ Three distinct states: Data, Empty, and Error
- ๐ ๏ธ Item manipulation methods (update/remove)
- ๐ Processing state tracking with
isProcessingnotifier - ๐ฏ Type-safe error handling
- ๐ Comprehensive documentation and examples
- ๐งช Production-ready implementation
Features #
- Flexible Cursor Types: Use any type as cursor (String, int, DateTime, or custom)
- State Management: Works with both ChangeNotifier and BLoC patterns
- Smart Auto-loading: Automatically loads next page when scrolling near bottom (200px threshold)
- Item Operations: Update or remove items without refetching entire list
- Error Handling: Type-safe error handling with custom error types
- Loading State: Built-in processing state for UI feedback
- Refresh Support: Pull-to-refresh and manual refresh capabilities
- Widget Builder:
CubitPaginatedListBuilderfor easy BLoC integration
API #
Core Classes
CursorPagination<T>- Generic pagination statePaginationResult<ItemType, CursorType, ErrorType>- Result wrapperPaginationControllerState<ItemType, CursorType, ErrorType>- Controller stateFlutterPaginationController<ItemType, CursorType, ErrorType>- ChangeNotifier controllerCubitPaginationController<ItemType, CursorType, ErrorType>- BLoC/Cubit controllerCubitPaginatedListBuilder<ItemType, CursorType, ErrorType>- Widget builder for BLoC
Methods
getFirst()- Load first pagegetNext()- Load next pagerefreshCurrent()- Refresh current pageupdateItemAt(index, item)- Update specific itemremoveItemAt(index)- Remove specific item
Dependencies #
flutter: sdkflutter_bloc: ^8.1.0
Migration Guide #
This is the initial release, no migration needed.