File tree 1 file changed +4
-1
lines changed
AndroidApp/app/src/main/java/com/example/androidapp
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -8,20 +8,23 @@ import io.flutter.embedding.engine.FlutterEngine
8
8
import io.flutter.embedding.engine.FlutterEngineCache
9
9
import io.flutter.embedding.engine.dart.DartExecutor
10
10
11
- private const val FLUTTER_ENGINE_ID = " flutter_engine "
11
+ private const val FLUTTER_ENGINE_ID = " module_flutter_engine "
12
12
13
13
class MainActivity : AppCompatActivity () {
14
14
lateinit var flutterEngine : FlutterEngine
15
15
override fun onCreate (savedInstanceState : Bundle ? ) {
16
16
super .onCreate(savedInstanceState)
17
17
setContentView(R .layout.activity_main)
18
18
19
+ // Instantiate a FlutterEngine
19
20
flutterEngine = FlutterEngine (this )
20
21
22
+ // Start executing Dart code to pre-warm the FlutterEngine
21
23
flutterEngine.dartExecutor.executeDartEntrypoint(
22
24
DartExecutor .DartEntrypoint .createDefault()
23
25
)
24
26
27
+ // Cache the FlutterEngine to be used by FlutterActivity
25
28
FlutterEngineCache
26
29
.getInstance()
27
30
.put(FLUTTER_ENGINE_ID , flutterEngine)
You can’t perform that action at this time.
0 commit comments