4)Learning diary for Flutter about problem

These days, I  troubled by  the  problem about Flutter Class not found.

Today I seen a example  from flutter sdk.

I found that creating FlutterView didn't use the Flutter Class

So, I tried this  method to create FlutterView Successful

I think the new version of sdk was not have Flutter Class already

 protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        if (flutterEngine == null) {
            flutterEngine = new FlutterEngine(this, null);
            flutterEngine.getDartExecutor().executeDartEntrypoint(
                    DartExecutor.DartEntrypoint.createDefault()
            );
        }
        FlutterView flutterView=findViewById(R.id.fv);
        flutterView.attachToFlutterEngine(flutterEngine);

    }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章