3

I am trying to integrate a flutter module in my iOS native app and would like to open different routes based on the option user selects on home screen.

As per the Flutter documentation , one can invoke initial route on flutter engines navigation channel in order to consider it as an initial route.

The problem is that if I try to set initial route on my warmed up Flutter engine before running, it doesn't work. I always get the defaultRouteName as "/" on the dart side. Am I missing something ?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Instantiate Flutter engine
    self.flutterEngine = FlutterEngine(name: "io.flutter")
    self.flutterEngine?.navigationChannel.invokeMethod("setInitialRoute", arguments: "/onboarding")
    self.flutterEngine?.run(withEntrypoint: nil)
    GeneratedPluginRegistrant.register(with: self.flutterEngine!)

    return true
}
user1398615
  • 289
  • 1
  • 7

0 Answers0