import Cocoa import FlutterMacOS class MainFlutterWindow: NSWindow { override func awakeFromNib() { let flutterViewController = FlutterViewController() self.contentViewController = flutterViewController // 桌面默认窗口 920×600(对齐设计稿 ui_kits/desktop),最小 720×560。 let defaultSize = NSSize(width: 920, height: 600) self.setContentSize(defaultSize) self.contentMinSize = NSSize(width: 720, height: 560) self.center() RegisterGeneratedPlugins(registry: flutterViewController) // P1 方案B:VPN 原生控制通道。把 VpnChannel.swift 加入 Runner target(Compile Sources) // 后,解开下一行注册(见 docs/p1-macos-system-extension.md §3)。在此之前保持注释, // 以免引用未编译符号破坏 Runner 构建。 // VpnChannel.register(with: flutterViewController.registrar(forPlugin: "VpnChannel")) super.awakeFromNib() } }