trigger method

void trigger({
  1. void scheduleTask(
    1. void task()
    )?,
})

This method triggers the task, but only if it has not already been executed during this run loop cycle.

If scheduleTask is set, this method will used to trigger the task

Implementation

void trigger({
  void Function(void Function() task)? scheduleTask,
}) {
  if (_isTriggered) {
    return;
  }

  _isTriggered = true;

  if (isTest) {
    return;
  }

  (scheduleTask ?? this.scheduleTask).call(_scheduledTask);
}