PaginatedBuilder<DataType, CursorType> class final

Manages caching and retrieval of Chunks using the provided paginator.

Commonly used as a wrapper around ListView.builder.

Inheritance

Constructors

PaginatedBuilder({required EnclosingWidgetBuilder listBuilder, required ConvertedWidgetBuilder<DataType> itemBuilder, required DataChunker<DataType, CursorType> dataChunker, Stream<PaginatedSnapshot<DataType>> listStartChangeStream = const Stream.empty(), int? chunkDataLimit, CursorSelector<DataType, CursorType>? cursorSelector, Widget? emptyWidget = const DefaultEmptyView(), bool enablePrintStatements = kDebugMode, Key? key, Widget? itemLoadingWidget = const DefaultBottomLoader(), Widget? pageLoadingWidget = const DefaultPageLoadingView(), ErrorWidgetBuilder? itemErrorWidgetBuilder, ErrorWidgetBuilder? pageErrorWidgetBuilder, ItemReceivedCallback<DataType?>? onItemReceived, void onListRebuild()?, bool rebuildListWhenChunkIsCached = false, bool rebuildListWhenStreamHasChanges = false, bool shouldShowItemLoader = true, double thresholdPercent = PaginatedBase.defaultThresholdPercent})
const

Properties

chunkDataLimit int?
Used to limit the amount of data returned with each chunk
finalinherited
cursorSelector CursorSelector<DataType, CursorType>?
Used to select the value to passed into the dataChunker the next time it's called.
finalinherited
dataChunker DataChunker<DataType, CursorType>
Called to retrieve the next n number of items from your data source.
finalinherited
emptyWidget Widget?
Optional replacement for the empty widget displayed when we've finished loading the first chunk and there are still no items
finalinherited
enablePrintStatements bool
Whether to enable print statements or not
finalinherited
hashCode int
The hash code for this object.
no setterinherited
itemBuilder ConvertedWidgetBuilder<DataType>
The item builder is the same callback used with ListView.builder with one exception. Normally you receive an index, whereas with this itemBuilder you receive your converted item at that index instead.
final
itemErrorWidgetBuilder ErrorWidgetBuilder?
Optional replacement for the error widget displayed when calling the paginatedItemBuilder fails
finalinherited
itemLoadingWidget Widget?
Optional replacement for the loading widget displayed at the end of the list while the next chunk is loading.
finalinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
listBuilder EnclosingWidgetBuilder
The function used to generate the widget shown when items exist in the cache.
finalinherited
listStartChangeStream Stream<PaginatedSnapshot<DataType>>
The stream listened to once the initial page load happens.
finalinherited
onItemReceived ItemReceivedCallback<DataType?>?
Invoked when data from a new chunk is received
finalinherited
onListRebuild → void Function()?
Invoked when the list rebuilds
finalinherited
pageErrorWidgetBuilder ErrorWidgetBuilder?
Optional replacement for the error widget displayed when getting the next chunk fails
finalinherited
pageLoadingWidget Widget?
Optional replacement for the loading widget displayed before the first chunk is loaded.
finalinherited
rebuildListWhenChunkIsCached bool
Whether to recreate the Widget provided in the listBuilder when items from a new chunk is added to the in-memory cache
finalinherited
rebuildListWhenStreamHasChanges bool
Whether to recreate the the Widget provided in the listBuilder after a change comes through on the listStartChangeStream.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shouldAutoLoadNextChunk bool
Whether to automatically load the next chunk of data when the threshold is met and more are available
finalinherited
shouldShowItemLoader bool
Whether to replace the last item in the list with a loading Widget when a new chunk is being retrieved.
finalinherited
thresholdPercent double
How far the user should be able to scroll into the last chunk before a new chunk is requested.
finalinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() PaginatedBuilderState<DataType, CursorType>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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