PaginatedDataMixin<T> mixin

Mixin for default AsyncNotifiers (AutoDisposeAsyncNotifier) (Providers created with @riverpod)

Implemented types

Properties

future Future<List<T>>
Obtains a Future that resolves with the first state value that is not AsyncLoading.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
queryFilter String?
getter/setter pair
ref → AutoDisposeAsyncNotifierProviderRef<List<T>>
The Ref from the provider associated with this AsyncNotifier.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state ↔ AsyncValue<List<T>>
The value currently exposed by this AsyncNotifier.
getter/setter pairinherited

Methods

build() FutureOr<List<T>>
Initialize an AsyncNotifier.
inherited
canFetch() bool
checks whether new data can be fetched. Overrides form PaginatedNotifier interface
override
getCurrentData() List<T>
Gets already available data. Overrides form PaginatedNotifier interface
override
getNextPage() Future<void>
Gets the next page of data by querying repository and sets the state
override
getPaginationData() Pagination
Gets the pagination data. Overrides form PaginatedNotifier interface
override
hasData() bool
checks whether data exists. Overrides form PaginatedNotifier Interface
override
init({required PaginatedDataRepository<T> dataFetcher}) Future<List<T>>
This method should be called inside the build method of your provider to initialize the pagination, state and data fetching.
listenSelf(void listener(AsyncValue<List<T>>? previous, AsyncValue<List<T>> next), {void onError(Object error, StackTrace stackTrace)?}) → void
Listens to changes on the value exposed by this provider.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh() Future<void>
Refreshes notifier without emptying data. Useful for implementing pull to refresh functionality Automatically invoked if pullToRefresh is true
override
setQueryFilter(String query) Future<void>
Use this to set any query params. The set value will be passed to the fetcher. Waits for the future.
override
toString() String
A string representation of this object.
inherited
update(FutureOr<List<T>> cb(List<T>), {FutureOr<List<T>> onError(Object err, StackTrace stackTrace)?}) Future<List<T>>
A function to update state from its previous value, while abstracting loading/error cases for state.
inherited
updateShouldNotify(AsyncValue<List<T>> previous, AsyncValue<List<T>> next) bool
A method invoked when the state exposed by this AsyncNotifier changes.
inherited

Operators

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