PaginatedStreamController<R, T> class

Controller for consuming a gRPC paginated stream one page at a time.

Usage:

final controller = PaginatedStreamController<MyResponse, MyItem>(
  streamFactory: () => client.search(request),
  extract: (response) => response.data,
);
await controller.loadFirstPage();
// later...
await controller.loadMore();

Constructors

PaginatedStreamController({required Stream<R> streamFactory(), required List<T> extract(R response), int maxPages = 20})

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state PaginatedState<T>
no setter
stateListenable ValueListenable<PaginatedState<T>>
no setter

Methods

dispose() → void
loadFirstPage() Future<void>
Start the stream and load the first page.
loadMore() Future<void>
Pause after each page, resume to get next page. With gRPC streams, data arrives continuously, so we just wait.
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