copyTo method
Implementation
void copyTo(Object dst) {
final Uint8List bytes = copyToBuffer();
if (dst is ByteBuffer) {
final ByteData byteData = dst.asByteData();
for (int i = 0; i < byteData.lengthInBytes; i++) {
byteData.setUint8(i, bytes[i]);
}
} else {
late Object obj;
if (dst is Uint8List) {
obj = bytes;
} else {
obj = _convertBufferToObject(bytes, type, shape);
}
if (obj is List && dst is List) {
_duplicateList(obj, dst);
} else {
throw UnsupportedError('${dst.runtimeType} is not Supported.');
}
}
}