lastOption property

T? get lastOption

safely access last element of list that may be empty.

Implementation

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