convertListToPointer function

Pointer<Float> convertListToPointer(
  1. List<double> floatList
)

Implementation

Pointer<Float> convertListToPointer(List<double> floatList) {
  // Create a native array to hold the double values
  final nativeArray = calloc<Double>(floatList.length);

  // Copy the values from the list to the native array
  for (var i = 0; i < floatList.length; i++) {
    nativeArray[i] = floatList[i];
  }

  // Obtain the pointer to the native array
  final nativePointer = nativeArray.cast<Float>();

  return nativePointer;
}