copyToBuffer method
Implementation
Uint8List copyToBuffer() {
final int size = TfLiteTensorByteSize(_ref);
final Pointer<Uint8> ptr = calloc<Uint8>(size);
checkState(ptr.address != nullptr.address, message: 'unallocated');
final Uint8List externalTypedData = ptr.asTypedList(size);
checkState(TfLiteTensorCopyToBuffer(_ref, ptr.cast(), size) == TfLiteStatus.kTfLiteOk);
// Clone the data, because once `free(ptr)`, `externalTypedData` will be volatile
final Uint8List buffer = externalTypedData.sublist(0);
calloc.free(ptr);
return buffer;
}