getDefaultPlatform function

PlatformType getDefaultPlatform()

A top level function taht obtains PlatformType based on the TargetPlatform and the kIsWeb.

If the kIsWeb is true, it will be web. If the kIsWeb is false, it will be obtained based on the TargetPlatform.

See also:

Implementation

PlatformType getDefaultPlatform() {
  if (kIsWeb) return PlatformType.web;

  switch (defaultTargetPlatform) {
    case TargetPlatform.android:
      return PlatformType.android;
    case TargetPlatform.fuchsia:
      return PlatformType.fuchsia;
    case TargetPlatform.iOS:
      return PlatformType.iOS;
    case TargetPlatform.macOS:
      return PlatformType.macOS;
    case TargetPlatform.windows:
      return PlatformType.windows;
    case TargetPlatform.linux:
      return PlatformType.linux;
  }
}