PaginatedBase<DataType, CursorType> class abstract base

Manages caching and retrieval of Chunks using the provided paginator.

Commonly used as a wrapper around ListView.builder.

Inheritance
Implementers

Constructors

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

Properties

chunkDataLimit int?
Used to limit the amount of data returned with each chunk
final
cursorSelector CursorSelector<DataType, CursorType>?
Used to select the value to passed into the dataChunker the next time it's called.
final
dataChunker DataChunker<DataType, CursorType>
Called to retrieve the next n number of items from your data source.
final
emptyWidget Widget?
Optional replacement for the empty widget displayed when we've finished loading the first chunk and there are still no items
final
enablePrintStatements bool
Whether to enable print statements or not
final
hashCode int
The hash code for this object.
no setterinherited
itemErrorWidgetBuilder ErrorWidgetBuilder?
Optional replacement for the error widget displayed when calling the paginatedItemBuilder fails
final
itemLoadingWidget Widget?
Optional replacement for the loading widget displayed at the end of the list while the next chunk is loading.
final
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.
final
listStartChangeStream Stream<PaginatedSnapshot<DataType>>
The stream listened to once the initial page load happens.
final
onItemReceived ItemReceivedCallback<DataType?>?
Invoked when data from a new chunk is received
final
onListRebuild → void Function()?
Invoked when the list rebuilds
final
pageErrorWidgetBuilder ErrorWidgetBuilder?
Optional replacement for the error widget displayed when getting the next chunk fails
final
pageLoadingWidget Widget?
Optional replacement for the loading widget displayed before the first chunk is loaded.
final
rebuildListWhenChunkIsCached bool
Whether to recreate the Widget provided in the listBuilder when items from a new chunk is added to the in-memory cache
final
rebuildListWhenStreamHasChanges bool
Whether to recreate the the Widget provided in the listBuilder after a change comes through on the listStartChangeStream.
final
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
final
shouldShowItemLoader bool
Whether to replace the last item in the list with a loading Widget when a new chunk is being retrieved.
final
thresholdPercent double
How far the user should be able to scroll into the last chunk before a new chunk is requested.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<StatefulWidget>
Creates the mutable state for this widget at a given location in the tree.
inherited
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

Constants

defaultThresholdPercent → const double
The default value used to define how far the user can scroll before the next chunk of data is retrieved.