dart:core
庫中List.of
的用法介紹如下。
用法:
List<E>.of(
Iterable<E> elements,
{bool growable = true}
)
從 elements
創建一個列表。
elements
的Iterator 提供了元素的順序。
當growable
為真時,此構造函數創建一個可增長列表;否則,它返回一個固定長度的列表。
final numbers = <int>[1, 2, 3];
final listOf = List<num>.of(numbers);
print(listOf); // [1, 2, 3]
相關用法
- Dart List.first用法及代碼示例
- Dart List.sort用法及代碼示例
- Dart List.fillRange用法及代碼示例
- Dart List.addAll用法及代碼示例
- Dart List.indexOf用法及代碼示例
- Dart List.removeWhere用法及代碼示例
- Dart List.reversed用法及代碼示例
- Dart List.removeRange用法及代碼示例
- Dart List.unmodifiable用法及代碼示例
- Dart List.clear用法及代碼示例
- Dart List.length用法及代碼示例
- Dart List.from用法及代碼示例
- Dart List.removeAt用法及代碼示例
- Dart List.lastIndexWhere用法及代碼示例
- Dart List.retainWhere用法及代碼示例
- Dart List.shuffle用法及代碼示例
- Dart List.removeLast用法及代碼示例
- Dart List.setAll用法及代碼示例
- Dart List.filled用法及代碼示例
- Dart List.empty用法及代碼示例
- Dart List.setRange用法及代碼示例
- Dart List.replaceRange用法及代碼示例
- Dart List.remove用法及代碼示例
- Dart List.asMap用法及代碼示例
- Dart List.add用法及代碼示例
注:本文由純淨天空篩選整理自dart.dev大神的英文原創作品 List<E>.of constructor。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。