firstOrNull property Null safety

T? firstOrNull

The first element, or null if the iterable is empty.

Implementation

T? get firstOrNull {
  var iterator = this.iterator;
  if (iterator.moveNext()) return iterator.current;
  return null;
}