submit<Q, R> method
Implementation
@override
Future<R> submit<Q, R>(Job<Q, R> job) async {
if (_disposed) {
throw CancellationException();
}
final completer = Completer<R>();
scheduleMicrotask(() async {
try {
if (_disposed || job.isCancelled) {
throw CancellationException();
}
completer.complete(await job.computeFunction(job.value));
} catch (error, stack) {
completer.completeError(error, stack);
}
});
return completer.future;
}