简体   繁体   English

在缓存的 Flutter 引擎中导航

[英]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.我有一个关于FlutterEngine的问题我有一个缓存的 flutter 引擎,我想在我的 android 应用程序的许多屏幕上重复使用它,所以我必须以某种方式导航缓存引擎内的路线。

Is there any way I can set the route of cached engine before starting the flutter activity?有什么办法可以在开始 flutter 活动之前设置缓存引擎的路线?

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经过一些研究和深入研究文档后,我发现 flutter 引擎提供了一个NavigationChannel ,可用于将路由推送/弹出到引擎中

Example, if you want to push a route:例如,如果要推送路由:

FlutterEngine engine = FlutterEngineCache.getInstance().get("MyFlutterEngine");
if (engine != null) {
    engine.getNavigationChannel().pushRoute("/myRoute2");
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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