GetCountryCodeForRegion method

int GetCountryCodeForRegion(
  1. String regionCode
)

Implementation

int GetCountryCodeForRegion(String regionCode) {
  final retValuePtr = calloc<Int32>();
  final regionCodeHstring = convertToHString(regionCode);

  try {
    final hr = _thisPtr.ref.vtable
            .elementAt(7)
            .cast<
                Pointer<
                    NativeFunction<
                        HRESULT Function(
                            Pointer, IntPtr regionCode, Pointer<Int32>)>>>()
            .value
            .asFunction<
                int Function(Pointer, int regionCode, Pointer<Int32>)>()(
        _thisPtr.ref.lpVtbl, regionCodeHstring, retValuePtr);

    if (FAILED(hr)) throw WindowsException(hr);

    final retValue = retValuePtr.value;
    return retValue;
  } finally {
    WindowsDeleteString(regionCodeHstring);
    free(retValuePtr);
  }
}