fillRange 方法
override
用 fillValue 覆盖元素范围。
设置大于或等于 start 且小于 end 的位置的值到 fillValue。
提供的范围,由 start 和 end 确定,必须有效。从 start 到 end 的范围有效当且仅当 0 ≤ start ≤ end ≤ length。空范围(即 end == start)是有效的。
如果元素类型是不可为空的,则必须提供 fillValue,并且它必须非 null。
示例
final words = List.filled(5, 'old');
print(words); // [old, old, old, old, old]
words.fillRange(1, 3, 'new');
print(words); // [old, new, new, old, old]
实现
void fillRange(int start, int end, [E? fillValue]) {
throw new UnsupportedError("Cannot modify an immutable List.");
}