Flutter Engine
The Flutter Engine
SpawnMultiEngineActivity.java
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5package dev.flutter.scenarios;
6
7import android.content.Context;
8import androidx.annotation.NonNull;
9import io.flutter.embedding.engine.FlutterEngine;
10import io.flutter.embedding.engine.FlutterEngineGroup;
11
13 static final String TAG = "Scenarios";
14
15 @Override
16 @NonNull
17 public FlutterEngine provideFlutterEngine(@NonNull Context context) {
18 FlutterEngineGroup engineGroup = new FlutterEngineGroup(context);
19 FlutterEngineGroup.Options options =
21 FlutterEngine firstEngine = engineGroup.createAndRunEngine(options);
22
23 FlutterEngine secondEngine = engineGroup.createAndRunEngine(options);
24
25 // Check that a new engine can be spawned from the group even if the group's
26 // original engine has been destroyed.
27 firstEngine.destroy();
28 FlutterEngine thirdEngine = engineGroup.createAndRunEngine(options);
29
30 return thirdEngine;
31 }
32}
const char * options
FlutterEngine provideFlutterEngine(@NonNull Context context)
Options setAutomaticallyRegisterPlugins(boolean automaticallyRegisterPlugins)
FlutterEngine createAndRunEngine( @NonNull Context context, @Nullable DartEntrypoint dartEntrypoint)