firstOrNull property

T? firstOrNull

Returns the first element.

Null is returned if it is itself Null or if there are no elements in the list.

最初の要素を返します。

自身がNullの場合かリストに要素がない場合はNullが返されます。

Implementation

T? get firstOrNull {
  if (this == null || isEmpty) {
    return null;
  }
  return this?.first;
}