toList方法
- bool growable = true,
元素顺序与迭代顺序相同。如果growable
为false,则列表长度固定。
示例
final planets = <int, String>{1: 'Mercury', 2: 'Venus', 3: 'Mars'};
final keysList = planets.keys.toList(growable: false); // [1, 2, 3]
final valuesList =
planets.values.toList(growable: false); // [Mercury, Venus, Mars]
实现
List<E> toList({bool growable = true}) =>
List<E>.of(this, growable: growable);