newList method
Creates a fixed-length list of this data type.
Implementation
@override
List<T> newList(int length,
{Map1<int, T>? generate, T? fillValue, bool readonly = false}) {
final result = emptyList(length);
if (generate != null) {
for (var i = 0; i < length; i++) {
result[i] = generate(i);
}
} else if (fillValue != null && fillValue != defaultValue) {
result.fillRange(0, length, fillValue);
}
return readonly ? readonlyList(result) : result;
}