首页 > 解决方案 > Android Activity Lifecycle 中的 Flutter configureFlutterEngine 方法

问题描述

在Android生命周期中究竟何时调用configureFlutterEngine()方法?在onCreate()中?

标签: androidflutter

解决方案


According to official Flutter API docs found in this link :

This method is called after the given FlutterEngine has been attached to the owning FragmentActivity.

The FlutterEngine is the container through which Dart code can be run in an Android application.

An explanation 'attached to the owning FragmentActivity' : Once an Activity is created, and its associated FlutterEngine is executing Dart code, the Activity should invoke this method. At that point the FlutterEngine is considered "attached" to the Activity and all ActivityAware plugins are given access to the Activity.


推荐阅读