'Is it possible to add part of list to ByteBuilder without twice copies in dart?
For example, I just want to copy the middle 4 elements of src to a ByteBuilder:
import 'dart:typed_data';
void main() async {
var s1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
var src = Uint8List.fromList(s1);
var bb = BytesBuilder();
var part = src.sublist(4, 8); // first copy
bb.add(part); // second copy
var other = bb.toBytes();
print("$other");
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
