allocate<T extends NativeType> method

Array<NativeType> allocate <T extends NativeType>(
  1. int length,
  2. List<int> getView(
    1. Pointer<T>,
    2. int
    )
)

Allocates Array of length. get_View returns the typed list of Pointer<T>

Implementation

static Array allocate<T extends NativeType>(
    int length, List<int> Function(Pointer<T>, int) getView) {
  final ptr = ffi.allocate<T>(count: length);
  final view = getView(ptr, length);
  return Array._(ptr, view);
}