toHstring method
Converts this Dart string to a WinRT HSTRING.
The resulting string is immutable and reference-counted by the WinRT runtime.
The returned HSTRING must be released using WindowsDeleteString,
unless scoped via an Arena.
Example:
final hstring = 'Hello'.toHstring();
// Use the HSTRING with WinRT APIs.
WindowsDeleteString(hstring); // Remember to delete when done.
Throws a WindowsException if string creation fails.
Implementation
HSTRING toHstring() {
if (isEmpty) return WindowsCreateString(null, 0);
return using((arena) => WindowsCreateString(arena.pcwstr(this), length));
}