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 notAsyncLoading
.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 thisAsyncNotifier
.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
interfaceoverride -
getCurrentData(
) → List< T> -
Gets already available data.
Overrides form
PaginatedNotifier
interfaceoverride -
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
interfaceoverride -
hasData(
) → bool -
checks whether data exists.
Overrides form
PaginatedNotifier
Interfaceoverride -
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< ? previous, AsyncValue<T> >List< next), {void onError(Object error, StackTrace stackTrace)?}) → voidT> > -
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 trueoverride -
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< cb(List<T> >T> ), {FutureOr<List< onError(Object err, StackTrace stackTrace)?}) → Future<T> >List< T> > -
A function to update
state
from its previous value, while abstracting loading/error cases forstate
.inherited -
updateShouldNotify(
AsyncValue< List< previous, AsyncValue<T> >List< next) → boolT> > -
A method invoked when the state exposed by this
AsyncNotifier
changes.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited