DriftPageProvider<T, C, K> class

PageProvider fetching items from the ScopedDriftProvider.

Inheritance

Constructors

DriftPageProvider({required K onKey(T), required C? onCursor(T?), FutureOr<List<T>> fetch({required int after, K? around, required int before})?, FutureOr<Stream<List<T>>> watch({int? after, K? around, int? before})?, bool watchUpdates(T a, T b) = _defaultWatchUpdates, Future<void> add(Iterable<T> items, {bool toView})?, Future<void> delete(K key)?, Future<void> reset()?, bool? isFirst(T)?, bool? isLast(T)?, Future<void> onNone(K key)?, int compare(T, T)?, bool fulfilledWhenNone = false, void onAdded(T)?, void onRemoved(T)?})

Properties

add Future<void> Function(Iterable<T> items, {bool toView})?
Callback, called when the provided T items should be persisted.
final
compare int Function(T, T)?
Callback, called to compare the provided T items.
final
delete Future<void> Function(K key)?
Callback, called when an item at the key should be deleted.
final
fetch FutureOr<List<T>> Function({required int after, K? around, required int before})?
Callback, called when the after and before amounts of T items around the provided K are required.
final
fulfilledWhenNone bool
Indicator whether the zero-item responses should be considered fulfilled.
final
hashCode int
The hash code for this object.
no setterinherited
isFirst bool? Function(T)?
Callback, called to indicate whether the provided T is the first.
final
isLast bool? Function(T)?
Callback, called to indicate whether the provided T is the last.
final
onAdded → void Function(T)?
Callback, called when the provided T item is added via watch.
final
onCursor → C? Function(T?)
Callback, called when a cursor of the provided T is required.
final
onKey → K Function(T)
Callback, called when a K of the provided T is required.
final
onNone Future<void> Function(K key)?
Callback, called when the provided key was invoked during init.
final
onRemoved → void Function(T)?
Callback, called when the provided T item is removed via watch.
final
reset Future<void> Function()?
Callback, called when this provider should clear all its data.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
watch FutureOr<Stream<List<T>>> Function({int? after, K? around, int? before})?
Callback, called when Stream of the T items around the provided K are required.
final
watchUpdates bool Function(T a, T b)
Callback, comparing the provided items when they update during watch to determine whether the onAdded should be invoked.
final

Methods

after(K? key, C? cursor, int count) Future<Page<T, C>>
Fetches the Page after the provided key or cursor.
override
around(K? key, C? cursor, int count) Future<Page<T, C>>
Fetches the Page around the provided key or cursor.
override
before(K? key, C? cursor, int count) Future<Page<T, C>>
Fetches the Page before the provided key or cursor.
override
clear() Future<void>
Clears this PageProvider.
override
dispose() → void
Disposes this PageProvider, freeing any resources it might've occupied.
override
init(K? key, int count) Future<Page<T, C>>
Initializes this PageProvider, loading initial Page, if any.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(Iterable<T> items, {int compare(T, T)?}) Future<void>
Adds the provided items to this PageProvider.
override
remove(K key) Future<void>
Removes the item specified by its key from this PageProvider.
override
toString() String
A string representation of this object.
inherited

Operators

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