Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

get second to last item in a list dart

var list = ['a', 'b', 'c', 'd'];
//index of last two element
final indexOfsecondToLast = list.length - 2; 

//index of last element
final indexOfLast = list.length - 1; 

//last element in array
final LastElement = list.elementAt(list.length - 1);

//last two element in an array
final secondToLastElement = list.elementAt(list.length - 2); 
 
PREVIOUS NEXT
Tagged: #item #list #dart
ADD COMMENT
Topic
Name
3+8 =