I'm doing it in this way:
Pointer<Uint8> _byteDataToPointer(ByteData byteData) {
final uint8List = byteData.buffer.asUint8List();
final length = uint8List.lengthInBytes;
final result = allocate<Uint8>(count: length);
for (var i = 0; i < length; ++i) {
result[i] = uint8List[i];
}
return result;
}
Is there a more efficient way like JNIEnv::GetByteArrayRegion in JNI?
Thank you very much!