copyList method
Creates a fixed-length list copy of this data type, possibly with a
modified length
and if necessary populated with fillValue
.
Implementation
List<T> copyList(Iterable<T> list, {int? length, T? fillValue}) {
final listLength = list.length;
final result = newList(length ?? listLength, fillValue ?? defaultValue);
result.setRange(0, math.min(result.length, listLength), list);
return result;
}