getTaskExecutor function Null safety

TaskExecutor getTaskExecutor(
  1. TaskDescriptor task
)

Returns the relevant TaskExecutor based on the type of task.

Implementation

TaskExecutor getTaskExecutor(TaskDescriptor task) {
  switch (task.runtimeType) {
    case TaskDescriptor:
      return TaskExecutor(task);
    case AutomaticTask:
      return AutomaticTaskExecutor(task as AutomaticTask);
    case AppTask:
      return AppTaskExecutor(task as AppTask);
    default:
      return TaskExecutor(task);
  }
}