Taosif7
Taosif7

Reputation: 351

Navigate in cached Flutter Engine

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.

Upvotes: 2

Views: 1634

Answers (1)

Taosif7
Taosif7

Reputation: 351

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");
}

Upvotes: 1

Related Questions