ActionDef class abstract base

One action. Every action can be turned off (enabled), run without being awaited (nonBlocking: the chain goes on at once and its failure doesn't stop it) and run only while a predicate holds (when). JSON: {"type": type, ...its fields, "enabled": false, "nonBlocking": true, "when": {...}}.

Each action type is declared by an ActionSpec in a Catalog; decoding looks the type up there. The core types are the sealed CoreAction family; each feature library has its own sealed family (DataAction, MediaAction, EngageAction) or class (AuthAction, PaywallAction); a type declared without a Dart class is a DeclaredAction, and a type the catalog doesn't declare an UnknownAction.

Implementers
Annotations
  • @immutable

Constructors

ActionDef({bool enabled = true, bool nonBlocking = false, Predicate? when})
const

Properties

enabled → bool
False skips the action.
final
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 setter
hashCode → int
The hash code for this object.
no setteroverride
nested → List<ActionDef>
The actions it runs itself (branches, follow-ups), in order.
no setter
nonBlocking → bool
The chain doesn't wait for it, and its failure doesn't stop the chain.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selfAndNested → Iterable<ActionDef>
This action, then every action nested in it, depth first.
no setter
type → String
The JSON type.
no setter
when → Predicate?
Runs only when it holds; null: always.
final

Methods

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

Operators

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

Static Properties

types → Iterable<String>
Every action type Catalog.current declares, by its JSON type.
no setter

Static Methods

fromJson(Object? json, {Catalog? catalog}) → ActionDef?
Decodes an action with catalog (default: Catalog.current); null for anything that isn't a JSON object with a type. A type the catalog doesn't declare is an UnknownAction.
listFromJson(Object? json, {Catalog? catalog}) → List<ActionDef>