PaginatedRemoterQuery<T> class

Used for data that has multiple pages or "infinite scroll" like experience. If T generic is used, all RemoterClient method calls should be called with T, otherwise runtime type casting error will be thrown

PaginatedRemoterQuery<T>(
      remoterKey: "key",
      getNextPageParam: (pages) {
        return pages[pages.length - 1].nextPage;
      },
      getPreviousPageParam: (pages) {
        return pages[0].previousPage;
      },
      execute: (param) async {
        // Fetch data here
      },
      listener: (oldState, newState) async {
        // Optional state listener
      },
      builder: (context, snapshot, utils) {
        if (snapshot.status == RemoterStatus.idle) {
          // You can skip this check if you don't use disabled parameter
        }
        if (snapshot.status == RemoterStatus.fetching) {
          // Handle fetching state here
        }
        if (snapshot.status == RemoterStatus.error) {
          // Handle error here
        }
        // It is okay to use snapshot.data! here
        return ...
      })
Inheritance

Constructors

PaginatedRemoterQuery({Key? key, dynamic getPreviousPageParam(List<T>)?, dynamic getNextPageParam(List<T>)?, RemoterOptions? options, dynamic listener(PaginatedRemoterData<T> oldState, PaginatedRemoterData<T> newState)?, bool? disabled, required String remoterKey, required FutureOr<T> execute(RemoterParam? param), required Widget builder(BuildContext context, PaginatedRemoterData<T> snapshot, RemoterPaginatedUtils<PaginatedRemoterData<T>> utils)})
Used for data that has multiple pages or "infinite scroll" like experience. If T generic is used, all RemoterClient method calls should be called with T, otherwise runtime type casting error will be thrown
const

Properties

builder Widget Function(BuildContext context, PaginatedRemoterData<T> snapshot, RemoterPaginatedUtils<PaginatedRemoterData<T>> utils)
Builder method that is called if data updates
final
disabled bool?
Query won't start executing if disabled is true
final
execute FutureOr<T> Function(RemoterParam? param)
Function to fetch data, receives parameter of RemoterParam which is data returned from getNextPageParam or getPreviousPageParam
final
getNextPageParam → (dynamic Function(List<T>)?)
Function receives current pages array and returns dynamic value which will be passed to execute Returning null means no more next page is available
final
getPreviousPageParam → (dynamic Function(List<T>)?)
Function receives current pages array and returns dynamic value which will be passed to execute Returning null means no more previous page is available
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
listener → (dynamic Function(PaginatedRemoterData<T> oldState, PaginatedRemoterData<T> newState)?)
Listener function that receives updates of data
final
options RemoterOptions?
Options that will be applied to only this query Omitted values in options will still fallback to top level options
final
remoterKey String
Unique identifier for query
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<PaginatedRemoterQuery<T>>
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}) 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