简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM