Flutter MacOS MethodChannel Communication to AppDelegate

428

In the current macOS template, the FlutterViewController (which lets you get the messenger, via .engine.binaryMessenger) is owned by the window, not the application. If you want to access it from the AppDelegate you'll need to wire up a connection between AppDelegate and MainFlutterWindow.

Share:
428
Boggle
Author by

Boggle

Updated on December 18, 2022

Comments

  • Boggle
    Boggle over 1 year

    How do you access the FlutterBinaryMessenger in the AppDelegate on the Swift side of a MacOS Flutter application? In all the examples I have found, the AppDelegate is just a placeholder. You need to get the FlutterBinaryMessenger to instantiate a FlutterMethodChannel to actually communicate to the Dart side.