lastOrNull property

T? lastOrNull

Returns the last element, or null if the list is empty.

Implementation

T? get lastOrNull => isEmpty ? null : last;