isWindowsRuntimeAvailable function Null safety

bool isWindowsRuntimeAvailable()

Detects whether the Windows Runtime is available by attempting to open its core library.

Implementation

bool isWindowsRuntimeAvailable() {
  try {
    DynamicLibrary.open('api-ms-win-core-winrt-l1-1-0.dll');
    // ignore: avoid_catching_errors
  } on ArgumentError {
    return false;
  }

  return true;
}