ConditionalSamplingEventTrigger
A trigger that triggers when a measurement of measureType is collected and an app-specific condition is met.
Note that the triggerCondition is a ConditionalEventEvaluator 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 ConditionalEventEvaluator methods. Hence, this trigger is mostly useful when creating a StudyProtocol directly in the app using Dart code.
If you need to de/serialize an event trigger, use the SamplingEventTrigger instead.
- Inheritance
-
- Object
- Serializable
- TriggerConfiguration
- ConditionalSamplingEventTrigger
- Annotations
-
- @JsonSerializable(includeIfNull: false, explicitToJson: true)
Constructors
ConditionalSamplingEventTrigger.fromJson
ConditionalSamplingEventTrigger
- required String measureType,
- ConditionalEventEvaluator? triggerCondition,
Creates a trigger that triggers when a measure of measureType is collected, and checks the triggerCondition to determine if the task should be triggered.
Properties
fromJsonFunction
The function which can convert a JSON string to an object of this type.
measureType
The data type of the event to look for.
triggerCondition
- @JsonKey(includeFromJson: false, includeToJson: false)
The function that decides, for each measurement, whether to trigger.
If null, this trigger never triggers.
Methods
toJson
Return a JSON encoding of this object.