2

I have a question regarding FlutterEngine I have a single cached flutter engine that I wanna reuse on many screens in my android app, so I'd have to somehow navigate the routes inside cached engine.

Is there any way I can set the route of cached engine before starting the flutter activity?

Thankyou.

Taosif7
  • 325
  • 1
  • 3
  • 9

1 Answers1

1

After some research and diving into documentation, I found out that flutter engine provides a NavigationChannel that can be used to push/pop routes into an engine

Example, if you want to push a route:

FlutterEngine engine = FlutterEngineCache.getInstance().get("MyFlutterEngine");
if (engine != null) {
    engine.getNavigationChannel().pushRoute("/myRoute2");
}
Taosif7
  • 325
  • 1
  • 3
  • 9