lastOrNull method
T
lastOrNull()
Returns the last element. If there is no last element it will
return null
.
Example:
['a', 'b'].lastOrElse(); // 'a'
[].lastOrElse(); // null
Implementation
T lastOrNull() => lastOrElse(() => null as T);