create static method

PlatformMenuDelegate create({
  1. MethodChannel? channel,
})

Creates an instance of IPadOSPlatformMenuDelegate for iOS platforms, or DefaultPlatformMenuDelegate for other platforms.

Optionally accepts a custom channel for testing purposes.

Implementation

static PlatformMenuDelegate create({MethodChannel? channel}) {
  if (defaultTargetPlatform != TargetPlatform.iOS) {
    return DefaultPlatformMenuDelegate();
  }
  return IPadOSPlatformMenuDelegate._internal(
    channel ?? const MethodChannel('flutter/ipados_menu'),
    <int, PlatformMenuItem>{},
  );
}