runTask<S> static method
S
runTask<
S>( - dynamic key,
- S run(
- EventQueue event
), {
- int channels = 1,
})
Implementation
static S runTask<S>(key, S Function(EventQueue event) run,
{int channels = 1}) {
final listKey = _TaskKeys(key, channels);
final queue =
_tempQueues.putIfAbsent(listKey, () => EventQueue(channels: channels));
return run(queue)
..whenComplete(() {
queue.runner.whenComplete(() {
Timer(Duration(milliseconds: delayRemove.maxThan(0)), () {
final cache = _tempQueues[listKey];
if (!queue.actived && cache == queue) {
_tempQueues.remove(listKey);
}
});
});
});
}