getNamedObjectOrDefault method
Implementation
JsonObject getNamedObjectOrDefault(String name, JsonObject defaultValue) {
final retValuePtr = calloc<COMObject>();
final nameHstring = convertToHString(name);
final hr = ptr.ref.vtable
.elementAt(7)
.cast<
Pointer<
NativeFunction<
HRESULT Function(
Pointer,
IntPtr name,
Pointer<COMObject> defaultValue,
Pointer<COMObject>)>>>()
.value
.asFunction<
int Function(Pointer, int name, Pointer<COMObject> defaultValue,
Pointer<COMObject>)>()(ptr.ref.lpVtbl, nameHstring,
defaultValue.ptr.cast<Pointer<COMObject>>().value, retValuePtr);
if (FAILED(hr)) {
free(retValuePtr);
throw WindowsException(hr);
}
WindowsDeleteString(nameHstring);
return JsonObject.fromRawPointer(retValuePtr);
}