Flutter Engine
The Flutter Engine
SpawnedEngineActivity.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
12public class SpawnedEngineActivity extends TestActivity {
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 engineGroup.createAndRunEngine(options);
22
23 FlutterEngine secondEngine = engineGroup.createAndRunEngine(options);
24
25 secondEngine
27 .setMessageHandler("take_screenshot", (byteBuffer, binaryReply) -> notifyFlutterRendered());
28
29 return secondEngine;
30 }
31}
const char * options
FlutterEngine provideFlutterEngine(@NonNull Context context)
Options setAutomaticallyRegisterPlugins(boolean automaticallyRegisterPlugins)
FlutterEngine createAndRunEngine( @NonNull Context context, @Nullable DartEntrypoint dartEntrypoint)
void setMessageHandler( @NonNull String channel, @Nullable BinaryMessenger.BinaryMessageHandler handler)