ConditionalPeriodicTrigger
A trigger that checks an app-specific condition every period and triggers when it is met.
Note that the triggerCondition is a ConditionalEvaluator function, which cannot be serialized to/from JSON. Thus, even though this trigger can be de/serialized from/to JSON, its triggerCondition cannot. This implies that this function cannot be retrieved as part of a StudyProtocol from a DeploymentService since it relies on specifying a Dart-specific function as the ConditionalEvaluator methods. Hence, this trigger is mostly useful when creating a StudyProtocol directly in the app using Dart code.
- Inheritance
-
- Object
- Serializable
- TriggerConfiguration
- ConditionalPeriodicTrigger
- Annotations
-
- @JsonSerializable(includeIfNull: false, explicitToJson: true)
Constructors
ConditionalPeriodicTrigger.fromJson
ConditionalPeriodicTrigger
- required Duration period,
- ConditionalEvaluator? triggerCondition,
Creates a ConditionalPeriodicTrigger.
Properties
fromJsonFunction
The function which can convert a JSON string to an object of this type.
period
How often to check the triggerCondition. Also checked once on resume.
triggerCondition
- @JsonKey(includeFromJson: false, includeToJson: false)
The function that decides whether to trigger.
If null, this trigger never triggers.
Methods
toJson
Return a JSON encoding of this object.