| j / k | Scroll down / up |
| gg | Scroll to top |
| G | Scroll to bottom |
| ⌘K / / | Open search |
| ? | Show this help |
| Esc | Close search / help |
| n / N | Next / previous section |
| h | Go to landing |
| d | Go to docs |
| : | Command mode — type section name |
Press ? or Esc to close
List screens extend a base pagination Cubit. Two strategies ship out of the box — offset-based and cursor-based — chosen by the API's metadata shape.
| Meta | Shape | When |
|---|---|---|
OffsetPaginationMeta | count, next, previous page numbers | Classic page-numbered feeds |
CursorPaginationMeta | nextCursor, previousCursor | Infinite scroll, stable ordering |
The feature Cubit extends PaginatedCubit<ItemT, FilterT, ExtraT> and implements only fetchPage. Load-more, refresh, and filtering are provided by the base.
class PostsCubit extends PaginatedCubit<PostModel, PostFilter, void> {
PostsCubit(this._store) : super(PaginatedState.initial());
@override
Future<ApiResponse<List<PostModel>, OffsetPaginationMeta>> fetchPage(
int page,
PostFilter? filters,
) =>
_store.getPosts(page: page, filters: filters);
}
// Provided by the base cubit:
// loadFirst() — page 1, replace list
// loadMore() — next page, append
// refresh() — reset to page 1
// applyFilters(f) / clearFilters() Same idea, but fetchPage takes the cursor string instead of a page number. The base tracks nextCursor and passes it forward on load-more.
class FeedCubit extends CursorPaginatedCubit<FeedItem, FeedFilter> {
FeedCubit(this._store) : super(CursorPaginatedState.initial());
@override
Future<ApiResponse<List<FeedItem>, CursorPaginationMeta>> fetchPage(
String? nextCursor,
FeedFilter? filters,
) =>
_store.getFeed(cursor: nextCursor, filters: filters);
} Both base cubits mix in ConnectivityReloadMixin. When connectivity returns, onReconnected() refreshes the current list automatically.
abstract class PaginatedCubit<ItemT, FilterT, ExtraT>
extends Cubit<PaginatedState<ItemT, FilterT, ExtraT>>
with ConnectivityReloadMixin {
@override
void onReconnected() => refresh();
} PaginatedListView wires a scroll controller to loadMore at the bottom and shows a shimmer while loading. Feature code just passes the cubit.