lastOrNull property

T? lastOrNull

Returns the last element.

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

最後の要素を返します。

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

Implementation

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