convertFromHString function Null safety winrt

String convertFromHString(
  1. int hstring
)

Takes a HSTRING (a WinRT String), and converts it to a Dart String.

Implementation

String convertFromHString(int hstring) {
  final stringLength = calloc<UINT32>();

  try {
    final stringPtr = WindowsGetStringRawBuffer(hstring, stringLength);
    final dartString = stringPtr.toDartString();

    return dartString;
  } finally {
    free(stringLength);
  }
}