poll method
E?
poll()
Retrieves and removes the head of this queue.
Returns null if this queue is empty.
Example:
final queue = Queue<String>();
queue.offer('hello');
final polled = queue.poll(); // 'hello'
final empty = queue.poll(); // null
Implementation
E? poll() {
if (_elements.isEmpty) {
return null;
}
return _elements.removeAt(0);
}