//This attribute tells the compiler that this piece of Swift code can be accessed from Objective-C.
 @objc(MessagesViewController)

 class MessagesViewController: MSMessagesAppViewController {
     override func viewDidLoad() {
         super.viewDidLoad()
         showFlutter()
     }
    
     @objc func showFlutter() {
         // Create a FlutterViewController with an implicit FlutterEngine
         let flutterViewController = FlutterViewController(project: nil, initialRoute: "/ext", nibName: nil, bundle: nil)
         present(flutterViewController, animated: true, completion: nil)
     }

Important:
  Commenting out sharedApplication disables
  many features in the Flutter framework.
  This hasn’t been tested in App Store submissions
  and might not work for some app extensions.

For example, home screen Widgets and Live Activities can’t use some
  lower-level APIs needed to draw Flutter UI.