Paginator<T> class

Efficiently paginates collections of items in an object-oriented manner.

Constructors

Paginator(Iterable<T> _items, {int itemsPerPage = 5, bool useCache = true})

Properties

canGoBack bool
Returns true if there are more items at lesser page indices than the current one.
no setter
canGoForward bool
Returns true if there are more items at greater page indices than the current one.
no setter
current PaginationResult<T>?
Fetches the current page. This will be cached until back or next is called.
no setter
hashCode int
The hash code for this object.
no setterinherited
index int
The current page index.
no setter
itemsPerPage int
The maximum number of items to be shown per page.
final
lastPageNumber int
Returns the greatest possible page number for this collection, given the number of itemsPerPage.
no setter
pageNumber int
The current page number. This is not the same as index.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
useCache bool
If true (default), then the results of paginations will be saved by page number.
final

Methods

back() → void
Moves the paginator back one page, if possible.
goToPage(int page) → void
Attempts to go the specified page. If it fails, then it will remain on the current page.
next() → void
Advances the paginator one page, if possible.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited