PaginatedDataRepository<T> class

Constructors

PaginatedDataRepository({required PaginatedDataFetcher<T> fetcher, String? queryFilter, int startPage = 1})
Queries and stores paginated data

Properties

data List<T>
Gets the stored data
no setter
fetcher → PaginatedDataFetcher<T>
The fetching function. You can initialize it with your repository method. or define a function directly. This way you don't need to create data repositories. Example
final
hashCode int
The hash code for this object.
no setterinherited
isFetching bool
Checks whether is already fetching
no setter
queryFilter String?
Optional query filter. This will be provided to the fetcher function and you can use it to build your URL
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startPage int
If you want to query data by skipping a few pages. Defaults to 1 and should be > 0. This will be provided to the the fetcher function as page parameter
final

Methods

canFetch() bool
Checks whether next page can be requested. Returns true if not fetching and is not already on the last page.
fetchData() Future<List<T>>
Fetches new data and returns the whole data using the supplied fetcher method. page and query is passed to the fetcher method If the last page is already fetched, no requests will be made and the existing data will be returned
getPaginationData() Pagination
Returns the current Pagination data
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetPagination({int? startPage}) → void
Resets pagination to defaults so that you can refetch the data Already stored data is not destroyed until new data is received
toString() String
A string representation of this object.
inherited

Operators

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