execute<P, R> method
Execute task
using this executor.
If task was already submitted the execution will be skipped.
Implementation
Future<R> execute<P, R>(AsyncTask<P, R> task,
{AsyncExecutorSharedDataInfo? sharedDataInfo}) {
if (task.wasSubmitted) {
return task.waitResult();
}
if (_closed) {
throw AsyncExecutorClosedError('Not ready: executor closed.');
} else if (_closing != null) {
logger.logWarn('Executing task while closing executor: $task');
}
if (!_started) {
return _executeNotStarted(task, sharedDataInfo);
} else {
return _executeAlreadyStarted(task, sharedDataInfo);
}
}