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映射