peek method

E? peek()

Retrieves, but does not remove, the head of this queue.

Returns null if this queue is empty.

Example:

final queue = LinkedQueue<int>();
queue.offer(100);
print(queue.peek()); // 100
print(queue.size()); // 1 (element still in queue)

Implementation

E? peek() {
  return _head?.data;
}