poll method
E?
poll()
Retrieves and removes the head of this queue.
Returns null if this queue is empty.
Example:
final queue = LinkedQueue<String>();
queue.offer('hello');
final polled = queue.poll(); // 'hello'
final empty = queue.poll(); // null
Implementation
E? poll() {
if (_head == null) {
return null;
}
final data = _head!.data;
_removeNode(_head!);
return data;
}