back method

T back()

Retrieves the last element of the vector.

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

Implementation

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