Flutter Engine
The Flutter Engine
FlutterEngineConfigurator.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 io.flutter.embedding.android;
6
7import androidx.annotation.NonNull;
8import androidx.lifecycle.Lifecycle;
9import io.flutter.embedding.engine.FlutterEngine;
10
11/**
12 * Configures a {@link io.flutter.embedding.engine.FlutterEngine} after it is created, e.g., adds
13 * plugins.
14 *
15 * <p>This interface may be applied to a {@link androidx.fragment.app.FragmentActivity} that owns a
16 * {@code FlutterFragment}.
17 */
18public interface FlutterEngineConfigurator {
19 /**
20 * Configures the given {@link io.flutter.embedding.engine.FlutterEngine}.
21 *
22 * <p>This method is called after the given {@link io.flutter.embedding.engine.FlutterEngine} has
23 * been attached to the owning {@code FragmentActivity}. See {@link
24 * io.flutter.embedding.engine.plugins.activity.ActivityControlSurface#attachToActivity(
25 * ExclusiveAppComponent, Lifecycle)}.
26 *
27 * <p>It is possible that the owning {@code FragmentActivity} opted not to connect itself as an
28 * {@link io.flutter.embedding.engine.plugins.activity.ActivityControlSurface}. In that case, any
29 * configuration, e.g., plugins, must not expect or depend upon an available {@code Activity} at
30 * the time that this method is invoked.
31 *
32 * @param flutterEngine The Flutter engine.
33 */
34 void configureFlutterEngine(@NonNull FlutterEngine flutterEngine);
35
36 /**
37 * Cleans up references that were established in {@link #configureFlutterEngine(FlutterEngine)}
38 * before the host is destroyed or detached.
39 *
40 * @param flutterEngine The Flutter engine.
41 */
42 void cleanUpFlutterEngine(@NonNull FlutterEngine flutterEngine);
43}
void cleanUpFlutterEngine(@NonNull FlutterEngine flutterEngine)
void configureFlutterEngine(@NonNull FlutterEngine flutterEngine)