getArrayAt method

JsonArray? getArrayAt(
  1. int index
)

Implementation

JsonArray? getArrayAt(int index) {
  final retValuePtr = calloc<COMObject>();

  final hr = ptr.ref.vtable
          .elementAt(7)
          .cast<
              Pointer<
                  NativeFunction<
                      HRESULT Function(
                          Pointer, Uint32 index, Pointer<COMObject>)>>>()
          .value
          .asFunction<int Function(Pointer, int index, Pointer<COMObject>)>()(
      ptr.ref.lpVtbl, index, retValuePtr);

  if (FAILED(hr)) {
    free(retValuePtr);
    throw WindowsException(hr);
  }

  if (retValuePtr.ref.lpVtbl == nullptr) {
    free(retValuePtr);
    return null;
  }

  return JsonArray.fromRawPointer(retValuePtr);
}