InfiniteQuery<DataType, ErrorType, PageType> class

A specialized Query that can retrieve + hold paginated/segmented data

  • nextPage provides the next page param for fetching
  • initialParam provides the initial page param for fetching

Use the InfiniteQueryBuilder create and use an InfiniteQuery

Inheritance

Constructors

InfiniteQuery(String key, InfiniteQueryFn<DataType, PageType> queryFn, {required InfiniteQueryNextPage<DataType, PageType> nextPage, required PageType initialPage, required RetryConfig retryConfig, required RefreshConfig refreshConfig, JsonConfig<DataType>? jsonConfig})

Properties

dataStream Stream<PageEvent<DataType, PageType>>
Stream of data events
no setter
debugState InfiniteQueryState<DataType, ErrorType, PageType>
A development-only way to access state outside of StateNotifier.
no setterinherited
errors List<ErrorType>
All the errors of pages that has failed to fetch
no setter
errorStream Stream<PageEvent<ErrorType, PageType>>
Stream of error events
no setter
getNextPage → PageType?
The next page param that will be used to fetch the next page
no setter
hasErrors bool
no setter
hashCode int
The hash code for this object.
no setteroverride
hasListeners bool
If a listener has been added using addListener and hasn't been removed yet.
no setterinherited
hasNextPage bool
no setter
hasPageData bool
no setter
hasPageError bool
no setter
hasPages bool
no setter
isInactive bool
no setter
isLoadingNextPage bool
no setter
isRefreshingPage bool
no setter
jsonConfig JsonConfig<DataType>?
final
key String
final
lastPage → PageType
The last page that has been fetched
no setter
mounted bool
Whether dispose was called or not.
no setterinherited
onError ↔ ErrorListener?
A callback for error reporting if one of the listeners added with addListener throws.
getter/setter pairinherited
pages List<DataType>
All the pages that has been successfully fetched
no setter
refreshConfig RefreshConfig
final
retryConfig RetryConfig
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state InfiniteQueryState<DataType, ErrorType, PageType>
The current "state" of this StateNotifier.
getter/setter pairinherited
stream Stream<InfiniteQueryState<DataType, ErrorType, PageType>>
A broadcast stream representation of a StateNotifier.
no setterinherited

Methods

addListener(Listener<InfiniteQueryState<DataType, ErrorType, PageType>> listener, {bool fireImmediately = true}) → RemoveListener
Subscribes to this object.
override
cancellableRetryOperation(FutureOr<DataType?> operation(), {required RetryConfig config, required void onSuccessful(DataType?), required void onFailed(ErrorType?)}) → CancelableOperation<void>
inherited
cast<NewDataType, NewErrorType, NewPageType>() InfiniteQuery<NewDataType, NewErrorType, NewPageType>
dispose() → void
Frees all the resources associated to this object.
override
fetch() Future<DataType?>
Fetch current non-fetched page
fetchNext() Future<DataType?>
Fetch the next page
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh([PageType? page]) Future<DataType?>
Refresh a page that has or has not been fetched
refreshAll() Future<List<DataType>?>
Refresh all the pages that has been fetched
reset() Future<void>
Reset all data, pages, error, events of this query
resolve(Widget data(List<DataType> data), {required Widget error(List<ErrorType> errors), required Widget loading(), Widget offline()?}) Widget
resolveWith(BuildContext context, Widget data(List<DataType> data), {required Widget error(List<ErrorType> error)?, required Widget loading()?, Widget offline()?}) Widget
retryOperation(FutureOr<DataType?> operation(), {required RetryConfig config, required void onSuccessful(DataType?), required void onFailed(ErrorType?)}) Future<void>
inherited
setPageData(PageType page, DataType data) → void
Manually set the data of a page
toString() String
A string representation of this object.
inherited
updateNextPageFn(InfiniteQueryNextPage<DataType, PageType> nextPage) → void
Replace the currently nextPage with new nextPage
updateQueryFn(InfiniteQueryFn<DataType, PageType> queryFn) → void
Replace the currently queryFn with new queryFn
updateShouldNotify(InfiniteQueryState<DataType, ErrorType, PageType> old, InfiniteQueryState<DataType, ErrorType, PageType> current) bool
Whether to notify listeners or not when state changes
inherited

Operators

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