getSliceBounds method
Returns the slice bounds for the current page.
Use this to slice your item list:
final (start, end) = paginator.getSliceBounds(items.length);
final visibleItems = items.sublist(start, end);
Implementation
(int start, int end) getSliceBounds(int length) {
final start = page * perPage;
final end = (page * perPage + perPage).clamp(0, length);
return (start, end);
}