lastOrNull property

T? lastOrNull

Returns the last element.

Return null if the list has no element.

Implementation

T? get lastOrNull {
  if (isEmpty) {
    return null;
  }
  return last;
}