Dart List.last属性

Dart List.last属性返回列表的最后一个元素。

语法

List.last

示例

void main() { 
   var lst = new List(); 
   lst.add(12); 
   lst.add(13); 
   print("The last element of the list is: ${lst.last}"); 
}

执行上面示例代码,得到以下结果 -

The last element of the list is: 13

上一篇: Dart列表 下一篇: Dart映射