copyList method

  1. @override
List<double> copyList(
  1. Iterable<double> iterable, {
  2. int? length,
  3. double? fillValue,
  4. bool readonly = false,
})
inherited

Creates a fixed-length list copy of the iterable, possibly with a modified length and if necessary populated with fillValue.

Implementation

@override
List<T> copyList(Iterable<T> iterable,
    {int? length, T? fillValue, bool readonly = false}) {
  final listLength = iterable.length;
  final result = emptyList(length ?? listLength);
  result.setRange(0, math.min(result.length, listLength), iterable);
  if (listLength < result.length &&
      fillValue != null &&
      fillValue != defaultValue) {
    result.fillRange(listLength, result.length, fillValue);
  }
  return readonly ? readonlyList(result) : result;
}