lastOrNull property
T?
get
lastOrNull
Returns the last element. If there is no last element it will
return null
.
Example:
['a', 'b'].lastOrNull); // 'b'
[].lastOrNull); // null
Implementation
T? get lastOrNull => length == 0 ? null : last;