lastOption property

Option<T> lastOption

Get the last element of the Iterable. If the Iterable is empty, return None.

Note: Because accessing the last element of an Iterable requires stepping through all the other elements, lastOption can be slow.

Implementation

Option<T> get lastOption => isEmpty ? const None() : some(last);