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.");
}