run<T> static method
Creates task.
Once created, it initializes the task, runs it, and returns an instance of it.
Changes the status of the task to TaskStatus.running.
Implementation
static Future<Task<T>> run<T>(TaskActionCallback<T> action,
{TaskOnErrorCallback? onError,
TaskOnDoneCallback<T>? onDone,
Map<String, dynamic>? data,
TaskType type = TaskType.oneShot}) async {
var task = Task<T>(action, onError: onError, onDone: onDone, type: type);
await task.initialize();
await task.start(data: data);
return task;
}