Skip to content

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
Annotations

Constructors

ConditionalSamplingEventTrigger.fromJson

ConditionalSamplingEventTrigger.fromJson(
  1. Map<String, dynamic> json
)

ConditionalSamplingEventTrigger

ConditionalSamplingEventTrigger({
  1. required String measureType,
  2. 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

Function get fromJsonFunction
override

The function which can convert a JSON string to an object of this type.

measureType

String measureType
getter/setter pair

The data type of the event to look for.

triggerCondition

  1. @JsonKey(includeFromJson: false, includeToJson: false)
ConditionalEventEvaluator? triggerCondition
getter/setter pair

The function that decides, for each measurement, whether to trigger.

If null, this trigger never triggers.

Methods

toJson

Map<String, dynamic> toJson()
override

Return a JSON encoding of this object.