firstOrNull property

T? firstOrNull

Returns the first element.

Return null if the list has no element.

Implementation

T? get firstOrNull {
  if (isEmpty) {
    return null;
  }
  return first;
}