LoadCloudDataAction class final

Streams a cloud document, or a collection query's documents, into variable variable while the screen shows: {status: loading|loaded| error, isLoading, data, error, hasMore}. A variable of type list gets the documents themselves, and with an aggregate, a number variable the number. Blocking actions wait for the first value; an initial failure stops the chain. A later subscription failure stops any remaining actions from that invocation and fires the canvas's actionError reaction. Subscriptions close on error or when the screen is disposed.

One variable has one live load: running the action again (or a ReloadCloudDataAction) replaces the earlier subscription. Unless reactive is false, the load runs again by itself when a value its query reads changes (${auth.uid}, ${search}, a limit bound to a variable), but never for a change of its own variable.

Inheritance

Constructors

LoadCloudDataAction({String variable = '', bool single = true, String id = '', CloudQueryDef query = const CloudQueryDef(), CloudDataScope scope = CloudDataScope.screen, String limit = '', CloudLoadAggregate aggregate = CloudLoadAggregate.none, String aggregateField = '', int refreshSeconds = 0, bool reactive = true, bool enabled = true, bool nonBlocking = false, Predicate? when})
const

Properties

aggregate → CloudLoadAggregate
A number over the query instead of its documents, computed by the database without loading them.
final
aggregateField → String
CloudLoadAggregate.sum and CloudLoadAggregate.average: the number field.
final
enabled → bool
False skips the action.
finalinherited
fieldsJson → Json
Its own fields, as JSON (sparse): what toJson writes besides type and the common fields. An action class outside this library overrides this.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
id → String
final
limit → String
The most documents to load: a number or an expression (${shown}), over CloudQueryDef.limit. Empty: the query's limit, else kDefaultCloudLoadLimit. 0 (or less) loads every document. The variable's hasMore says whether more documents match.
final
nested → List<ActionDef>
The actions it runs itself (branches, follow-ups), in order.
no setterinherited
nonBlocking → bool
The chain doesn't wait for it, and its failure doesn't stop the chain.
finalinherited
query → CloudQueryDef
The collection (CloudQueryDef.collectionPath) and, for a query, its filters, sorts, limit and joins.
final
reactive → bool
Whether the load runs again when a value its query reads changes.
final
refreshSeconds → int
An aggregate runs again after this app's writes to the collection and, when above 0, every this many seconds (writes made elsewhere).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scope → CloudDataScope
Who keeps the subscription: the screen (until it goes), or the app (CloudDataScope.app): one subscription per app, shared by every screen, writing an app variable. Older runtimes load per screen.
final
selfAndNested → Iterable<ActionDef>
This action, then every action nested in it, depth first.
no setterinherited
single → bool
One document (id of query's collection) or the query's documents.
final
type → String
The JSON type.
no setteroverride
variable → String
final
when → Predicate?
Runs only when it holds; null: always.
finalinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Json
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Constants

typeName → const String