getTaskExecutor method

TaskExecutor<TaskConfiguration> getTaskExecutor(
  1. TaskConfiguration task
)

Get the TaskExecutor for a task based on the task name. If the task executor does not exist, a new one is created based on the type of the task.

Implementation

TaskExecutor getTaskExecutor(TaskConfiguration task) {
  if (_taskExecutors[task.name] == null) {
    TaskExecutor executor = BackgroundTaskExecutor();
    if (task is AppTask) executor = AppTaskExecutor();
    if (task is FunctionTask) executor = FunctionTaskExecutor();

    _taskExecutors[task.name] = executor;
  }

  return _taskExecutors[task.name]!;
}