当前位置: 首页 > 文档资料 > Dart 中文教程 >

first

优质
小牛编辑
122浏览
2023-12-01

此属性返回列表中的第一个元素。

语法 (Syntax)

List.first

例子 (Example)

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

它将产生以下output - 。

The first element of the list is: 12