yearAsTruncatedString method

String yearAsTruncatedString(
  1. int remainingDigits
)

Implementation

String yearAsTruncatedString(int remainingDigits) {
  final retValuePtr = calloc<HSTRING>();

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

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

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