dart:html 库中ImmutableListMixin.fillRange 方法的用法介绍如下。
用法:
void fillRange(
int start,
int end,
[E? fillValue]
)
override
用 fillValue 覆盖一系列元素。
将大于或等于 start 且小于 end 的位置设置为 fillValue 。
start 和 end 提供的范围必须有效。如果 0 ≤ start ≤ end ≤ length ,则从 start 到 end 的范围是有效的。空范围(带有 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]
相关用法
- Dart ImmutableListMixin.replaceRange用法及代码示例
- Dart ImmutableListMixin.insert用法及代码示例
- Dart ImmutableListMixin.addAll用法及代码示例
- Dart ImmutableListMixin.shuffle用法及代码示例
- Dart ImmutableListMixin.retainWhere用法及代码示例
- Dart ImmutableListMixin.removeLast用法及代码示例
- Dart ImmutableListMixin.remove用法及代码示例
- Dart ImmutableListMixin.add用法及代码示例
- Dart ImmutableListMixin.insertAll用法及代码示例
- Dart ImmutableListMixin.removeRange用法及代码示例
- Dart ImmutableListMixin.removeWhere用法及代码示例
- Dart ImmutableListMixin.setRange用法及代码示例
- Dart ImmutableListMixin.removeAt用法及代码示例
- Dart ImmutableListMixin.sort用法及代码示例
- Dart ImmutableListMixin.setAll用法及代码示例
- Dart Iterator用法及代码示例
- Dart Iterable.takeWhile用法及代码示例
- Dart Int32x4List.view用法及代码示例
- Dart IterableMixin.isNotEmpty用法及代码示例
- Dart IterableMixin.firstWhere用法及代码示例
- Dart IterableMixin.lastWhere用法及代码示例
- Dart Iterable.skipWhile用法及代码示例
- Dart IterableMixin.every用法及代码示例
- Dart Iterable.toSet用法及代码示例
- Dart Int64List.sublist用法及代码示例
注:本文由纯净天空筛选整理自dart.dev大神的英文原创作品 fillRange method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
