front method

T front()

Retrieves the first element of the vector.

Guarantees memory safety by throwing a StateError if the vector is empty.

Implementation

T front() {
  if (_data.isEmpty) {
    throw StateError('Cannot get front from an empty vector');
  }
  return _data.first;
}