lastOrNull property

TValue? lastOrNull

Returns the last element of the iterable if not empty, null otherwise.

Implementation

TValue? get lastOrNull => isNotEmpty ? last : null;