formatPartialString method

String formatPartialString(
  1. String number
)

Implementation

String formatPartialString(String number) {
  final retValuePtr = calloc<HSTRING>();
  final numberHstring = convertToHString(number);

  try {
    final hr = ptr.ref.vtable
            .elementAt(8)
            .cast<
                Pointer<
                    NativeFunction<
                        HRESULT Function(
                            Pointer, IntPtr number, Pointer<IntPtr>)>>>()
            .value
            .asFunction<int Function(Pointer, int number, Pointer<IntPtr>)>()(
        ptr.ref.lpVtbl, numberHstring, retValuePtr);

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

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