dequeue method
Implementation
@override
RunFunction? dequeue({ dynamic? key }) {
_PriorityQueueOptions? item;
if (key != null) {
int idx = _map[key] != null ? _queue.indexOf(_map[key]!) : -1;
item = idx >= 0 ? _queue.removeAt(idx) : null;
} else {
item = _queue.isNotEmpty
? _queue.removeAt(0)
: null;
}
if (item?.key != null) {
_map.remove(item?.key);
}
return item?.run;
}