removeFirst method

V? removeFirst()

Removes and returns the next item: FIFO from the first-added priority bucket (NOT the lowest priority value — see the class doc), or null when the map is empty. Emptied buckets are pruned. Audited: 2026-06-12 11:26 EDT

Implementation

V? removeFirst() {
  if (_queues.isEmpty) return null;
  final entry = _queues.entries.firstOrNull;
  if (entry == null) return null;
  final List<V> q = entry.value;
  final V v = q.removeAt(0);
  final K key = entry.key;
  if (q.isEmpty) _queues.remove(key);
  return v;
}