dart:js 庫中JsArray.setRange 方法的用法介紹如下。
用法:
void setRange(
int start,
int end,
Iterable<E> iterable,
[int skipCount = 0]
)
override
將iterable 的一些元素寫入此列表的範圍。
將 iterable 的對象,首先跳過 skipCount 對象,複製到此列表的從 start (含)到 end (不含)的範圍內。
final list1 = <int>[1, 2, 3, 4];
final list2 = <int>[5, 6, 7, 8, 9];
// Copies the 4th and 5th items in list2 as the 2nd and 3rd items
// of list1.
const skipCount = 3;
list1.setRange(1, 3, list2, skipCount);
print(list1); // [1, 8, 9, 4]
start 和 end 提供的範圍必須有效。如果 0 ≤ start ≤ end ≤ length ,則從 start 到 end 的範圍是有效的。空範圍(帶有 end == start )是有效的。
跳過 skipCount 對象後,iterable 必須有足夠的對象來填充從 start 到 end 的範圍。
如果 iterable 是此列表,則即使兩個範圍重疊,該操作也會正確地將最初在 skipCount 到 skipCount + (end - start) 範圍內的元素複製到範圍 start 到 end 。
如果iterable 以其他方式依賴於該列表,則不作任何保證。
相關用法
- Dart JsArray.sort用法及代碼示例
- Dart JsArray.removeAt用法及代碼示例
- Dart JsArray.removeLast用法及代碼示例
- Dart JsArray.length用法及代碼示例
- Dart JsArray.removeRange用法及代碼示例
- Dart JsArray.addAll用法及代碼示例
- Dart JsArray.insert用法及代碼示例
- Dart JsArray.add用法及代碼示例
- Dart JsonEncoder用法及代碼示例
- Dart JsonCodec用法及代碼示例
- Dart JsonDecoder用法及代碼示例
- Dart MapMixin.containsKey用法及代碼示例
- Dart Iterator用法及代碼示例
- Dart AttributeClassSet.intersection用法及代碼示例
- Dart num.sign用法及代碼示例
- Dart TransformList.last用法及代碼示例
- Dart FileList.first用法及代碼示例
- Dart CanvasRenderingContext2D.drawImageScaledFromSource用法及代碼示例
- Dart FileList.length用法及代碼示例
- Dart Iterable.takeWhile用法及代碼示例
- Dart LinkedHashMap用法及代碼示例
- Dart RegExp.pattern用法及代碼示例
- Dart StreamTransformer構造函數用法及代碼示例
- Dart ListMixin.expand用法及代碼示例
- Dart UriData.parse用法及代碼示例
注:本文由純淨天空篩選整理自dart.dev大神的英文原創作品 setRange method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
