ScriptedPageFetcher<Q, T, C extends Object> class

A PageFetcher whose requests are completed by hand, so a test controls the order in which responses arrive. Every request is logged.

final pages = ScriptedPageFetcher<String, Item, int>();
final manager = ReactivePagedManager<String, Item, int>(
  fetchPage: pages.call,
  idOf: (i) => i.id,
);
final f = manager.loadNext('q');
pages.completeLast([item], next: 2);
await f;

Constructors

ScriptedPageFetcher()

Properties

hashCode → int
The hash code for this object.
no setterinherited
pending → int
How many requests are still waiting for a response.
no setter
requests → List<PageRequest<Q, C>>
Every request received so far, in order.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(PageRequest<Q, C> request) → Future<PageResult<T, C>>
Pass this as fetchPage.
complete(int index, List<T> items, {C? next, C? previous, int? totalCount}) → void
Responds to request index (0-based, in arrival order).
completeLast(List<T> items, {C? next, C? previous, int? totalCount}) → void
Responds to the most recent request.
fail(int index, Object error, [StackTrace? stackTrace]) → void
Fails request index.
failLast(Object error, [StackTrace? stackTrace]) → void
Fails the most recent request.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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