copyFromBuffer method

void copyFromBuffer(
  1. Uint8List buffer
)

Implementation

void copyFromBuffer(Uint8List buffer) {
  final int size = buffer.length;
  final Pointer<Uint8> ptr = calloc<Uint8>(size);
  checkState(ptr.address != nullptr.address, message: 'unallocated');
  final Uint8List externalTypedData = ptr.asTypedList(size);
  externalTypedData.setRange(0, buffer.length, buffer);
  checkState(TfLiteTensorCopyFromBuffer(_ref, ptr.cast(), buffer.length) == TfLiteStatus.kTfLiteOk);
  calloc.free(ptr);
}