List
var fruits = ['apples', 'oranges'];
fruits.add('kiwis');
fruits.addAll(['grapes', 'bananas']);
var appleIndex = fruits.indexOf('apples');
print(appleIndex);
fruits.removeAt(appleIndex);
print(fruits);
print(students.contains('bananas'));
fruits.clear();
print(fruits.isEmpty);
var vegetables = List.filled(3, 'broccoli');
print(vegetables);
print(vegetables.every((v) => v == 'broccoli'));
List numbers = [2, 8, 4, 6, 7, 3];
print(numbers.any((element) => element == 8));
print(numbers.reduce((value, element) => value + element));
print(numbers.fold(10, (value, element) => (value as int) + element));
numbers.forEach((element) => print(element));
print(numbers.map((e) => e + 1).toList());
numbers.sort((a, b) => a.compareTo(b));
print(numbers);
print(numbers.where((element) => element >= 6).toList());
print(numbers.firstWhere((element) => element >= 6));
print(numbers.singleWhere((element) => element >= 8));
print(numbers.take(2).toList());
print(numbers.skip(2).toList());
numbers = [
[1, 2],
[3, 4]
];
print(numbers.expand((element) => element).toList());
List.from(numbers);
Set
Set()
Set.from()
Set.identity()
Set.of
Set.unmodifiable
first
hashCode
isEmpty
isNotEmpty
iterator
last
length
runtimeType
single
方法
add
addAll
any
cast
clear
contains
containsAll
difference
elementAt
every
expand
firstWhere
fold
followedBy
forEach
intersection
join
lastWhere
lookup
map
noSuchMethod
reduce
remove
removeAll
removeWhere
retainAll
retainWhere
singleWhere
skip
skipWhile
take
takeWhile
toList
toSet
toString
union
where
whereType
Map