getUUID method Null safety

String getUUID(
  1. int index
)

Implementation

String getUUID(int index) {
  Pointer<Pointer<Uint8>> _emptyPointerList = malloc.allocate(sizeOf<Pointer<Pointer<Uint8>>>() * 2);
  _emptyPointerList[0] = malloc.allocate(sizeOf<Pointer<Int32>>());
  _emptyPointerList[1] = malloc.allocate(1000);

  Pointer<Int32> byteCount = Pointer.fromAddress(_emptyPointerList[0].address);
  byteCount.value = 0;

  final atByIndex = _dll_handle
      .lookupFunction<_DynamicTemplateIndex_at_by_index_c, _DynamicTemplateIndex_at_by_index_dart>(_c_namespace + "DynamicTemplateIndex_at_by_index");

  var exception = _getException();
  atByIndex(_impl, index, _emptyPointerList.cast(), Pointer.fromFunction(writeFunc), exception);
  checkException(exception, _dll_handle);

  List<int> result = [];
  for (var i = 0; i < byteCount.value; i++) {
    result.add(_emptyPointerList[1][i]);
  }
  malloc.free(_emptyPointerList[0]);
  malloc.free(_emptyPointerList[1]);
  malloc.free(_emptyPointerList);

  return utf8.decode(result);
}