RemoterQuery<T> class
Used for fetching remote data, revalidating it and etc.
If T
generic is used, all RemoterClient method calls should be called with T
,
otherwise runtime type casting error will be thrown
RemoterQuery<T>(
remoterKey: "key",
listener: (oldState, newState) async {
// Optional state listener
},
execute: () async {
// Fetch data here
},
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
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- RemoterQuery
Constructors
-
RemoterQuery({Key? key, dynamic listener(RemoterData<
T> oldState, RemoterData<T> newState)?, RemoterOptions? options, bool? disabled, required String remoterKey, required FutureOr<T> execute(), required Widget builder(BuildContext context, RemoterData<T> snapshot, RemoterQueryUtils<RemoterData< utils)})T> > -
Used for fetching remote data, revalidating it and etc.
If
T
generic is used, all RemoterClient method calls should be called withT
, otherwise runtime type casting error will be thrownconst
Properties
-
builder
→ Widget Function(BuildContext context, RemoterData<
T> snapshot, RemoterQueryUtils<RemoterData< utils)T> > -
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() -
Function to fetch data
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(RemoterData<
T> oldState, RemoterData<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< RemoterQuery< 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