hasMenu method Null safety

bool hasMenu(
  1. PlatformProvidedMenuItemType menu
)

Checks to see if the given default menu type is supported on this platform.

Implementation

static bool hasMenu(PlatformProvidedMenuItemType menu) {
  switch (defaultTargetPlatform) {
    case TargetPlatform.android:
    case TargetPlatform.iOS:
    case TargetPlatform.fuchsia:
    case TargetPlatform.linux:
    case TargetPlatform.windows:
      return false;
    case TargetPlatform.macOS:
      return const <PlatformProvidedMenuItemType>{
        PlatformProvidedMenuItemType.about,
        PlatformProvidedMenuItemType.quit,
        PlatformProvidedMenuItemType.servicesSubmenu,
        PlatformProvidedMenuItemType.hide,
        PlatformProvidedMenuItemType.hideOtherApplications,
        PlatformProvidedMenuItemType.showAllApplications,
        PlatformProvidedMenuItemType.startSpeaking,
        PlatformProvidedMenuItemType.stopSpeaking,
        PlatformProvidedMenuItemType.toggleFullScreen,
        PlatformProvidedMenuItemType.minimizeWindow,
        PlatformProvidedMenuItemType.zoomWindow,
        PlatformProvidedMenuItemType.arrangeWindowsInFront,
      }.contains(menu);
  }
}