无涯教程-Dart - last函数

91 阅读1分钟

返回列表中的最后一个元素。

last - 语法

List.last 

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 

参考链接

www.learnfk.com/dart-progra…