lastIndex property

int get lastIndex

Index of the last element or -1 if the collection is empty.

[1, 2, 3].lastIndex; // 2

[].lastIndex; // -1

Implementation

int get lastIndex => length - 1;