FlutterEngine flutterEngine = new FlutterEngine(this);
flutterEngine.getDartExecutor().executeDartEntrypoint(DartExecutor.DartEntrypoint
.createDefault());
FlutterEngineCache.getInstance().put(CACHE_ENGINE_ID, flutterEngine);
就是通过老师给的文档的写法优化的。
还有就是通过文档中第一种启动flutter页面的方式没办法传递参数了
startActivity(FlutterActivity
.withCachedEngine(MyApplication.CACHE_ENGINE_ID)
.build(MainActivity.this)))