clone method

HString clone()

Creates a copy of the existing string.

Implementation

HString clone() {
  if (handle == 0) return const HString.empty();
  return using((arena) {
    final pNewString = arena<HSTRING>();
    final hr = WindowsDuplicateString(handle, pNewString);
    if (FAILED(hr)) throwWindowsException(hr);
    return HString._(pNewString.value);
  });
}