readMentalData method

List<MindData> readMentalData()

Implementation

List<MindData> readMentalData() {
  return _usingOp<List<MindData>>((arena, opStatus) {
    final sizePointer = arena<Int>();
    _getMentalDataArraySize(arena, opStatus, sizePointer);

    final nativeArray = arena.allocate<NativeMindData>(sizeOf<NativeMindData>() * sizePointer.value);
    bindings.MathLibReadMentalDataArr(_pointer, nativeArray, sizePointer, opStatus);
    opStatus.ref.throwIfNotSuccessful();

    final results = <MindData>[];
    for (int i = 0; i < sizePointer.value; i++) {
      results.add(nativeArray[i].toManaged());
    }

    return results;
  });
}