first method

Option<T> first()

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

Implementation

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