last method

Option<T> last()

Returns the last element of an iterator, None if empty.

Implementation

Option<T> last() {
  final last = list.lastOrNull;
  if (last == null) {
    return None;
  }
  return Some(last);
}