paginatorBuilder method
Paginator<DataType, CursorType>
paginatorBuilder(
- CursorSelector<
DataType, CursorType> cursorSelector, - DataChunker<
DataType, CursorType> dataChunker
Implementation
Paginator<DataType, CursorType> paginatorBuilder(
CursorSelector<DataType, CursorType> cursorSelector,
DataChunker<DataType, CursorType> dataChunker,
) {
return (Chunk<DataType, CursorType> chunk) async {
// If we're passing back in the last value, immediately return.
if (chunk.status == ChunkStatus.last) return chunk;
_chunksRequested++;
conditionalPrint(
'paginated_builder: making request for chunk at cursor ${chunk.cursor}',
);
return Chunker<DataType, CursorType>(
cursorSelector: cursorSelector,
dataChunker: dataChunker,
).getNext(chunk);
};
}