isDesktop top-level property

bool get isDesktop

Test if we are running on a desktop platform and not in a browser.

Implementation

bool get isDesktop {
  if (kIsWeb) return false;

  return Platform.isLinux || Platform.isMacOS || Platform.isWindows;

  // Another approach is:

  // return [
  //   TargetPlatform.windows,
  //   TargetPlatform.linux,
  //   TargetPlatform.macOS,
  // ].contains(defaultTargetPlatform);
}