Dart List.first属性

Dart List.first属性返回列表中的第一个元素。

语法

List.first

示例

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

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

The first element of the list is: 12

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