last():
The last element.
Throws a StateError if this is empty. Otherwise may iterate through the elements and returns the last one seen. Some iterables may have more efficient ways to find the last element
void main() {
var nums = [1, 2, 3, 4, 5, 6, 7, 8];
print(nums.last);
}
8
Exited.