front method

T front()

Retrieves the first element of the list. Throws a StateError if the list is empty.

Implementation

T front() {
  if (_head == null) {
    throw StateError('Cannot get front of an empty ForwardList');
  }
  return _head!.value;
}