intListToArray function

Pointer<Int> intListToArray(
  1. List<int> list
)

Convert Dart int list to C int array.

Implementation

Pointer<Int> intListToArray(List<int> list) {
  final length = list.length;
  final pointer = calloc<Int>(length + 1); // +1 if null-terminated.
  for (int index = 0; index < length; index++) {
    pointer[index] = list[index];
  }
  return pointer;
}