createTriggerExecutor method

TriggerExecutor<TriggerConfiguration>? createTriggerExecutor(
  1. String studyDeploymentId,
  2. int triggerId,
  3. TriggerConfiguration trigger
)

Create a TriggerExecutor based on the studyDeploymentId and triggerId. Returns null if trigger is not supported by any registered TriggerFactory factories.

Implementation

TriggerExecutor? createTriggerExecutor(
  String studyDeploymentId,
  int triggerId,
  TriggerConfiguration trigger,
) {
  TriggerExecutor? executor;

  if (_triggerFactories[trigger.runtimeType] != null) {
    executor = _triggerFactories[trigger.runtimeType]!.create(trigger);
  }

  if (executor == null) {
    warning(
      "$runtimeType - Cannot create a TriggerExecutor for trigger type '${trigger.runtimeType}'.",
    );
  } else {
    _triggerExecutors[studyDeploymentId] = {};
    _triggerExecutors[studyDeploymentId]?[triggerId] = executor;
  }
  return _triggerExecutors[studyDeploymentId]?[triggerId];
}