Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Protected Attributes | Package Functions | Package Attributes | List of all members
io.flutter.embedding.android.FlutterFragment Class Reference
Inheritance diagram for io.flutter.embedding.android.FlutterFragment:
io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.DelegateFactory io.flutter.embedding.android.FlutterEngineProvider io.flutter.embedding.android.FlutterEngineConfigurator io.flutter.plugin.platform.PlatformPlugin.PlatformPluginDelegate

Classes

interface  ActivityCallThrough
 
class  CachedEngineFragmentBuilder
 
class  NewEngineFragmentBuilder
 
class  NewEngineInGroupFragmentBuilder
 

Public Member Functions

FlutterActivityAndFragmentDelegate createDelegate (FlutterActivityAndFragmentDelegate.Host host)
 
 FlutterFragment ()
 
ExclusiveAppComponent< Activity > getExclusiveAppComponent ()
 
void onAttach (@NonNull Context context)
 
void onCreate (@Nullable Bundle savedInstanceState)
 
View onCreateView (LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
 
void onStart ()
 
void onResume ()
 
void onPostResume ()
 
void onPause ()
 
void onStop ()
 
void onViewCreated (View view, Bundle savedInstanceState)
 
void onDestroyView ()
 
void onSaveInstanceState (Bundle outState)
 
void detachFromFlutterEngine ()
 
void onDetach ()
 
void onRequestPermissionsResult (int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)
 
void onNewIntent (@NonNull Intent intent)
 
void onBackPressed ()
 
void onActivityResult (int requestCode, int resultCode, Intent data)
 
void onUserLeaveHint ()
 
void onTrimMemory (int level)
 
FlutterShellArgs getFlutterShellArgs ()
 
String getCachedEngineId ()
 
String getCachedEngineGroupId ()
 
boolean shouldDestroyEngineWithHost ()
 
String getDartEntrypointFunctionName ()
 
List< String > getDartEntrypointArgs ()
 
String getDartEntrypointLibraryUri ()
 
String getAppBundlePath ()
 
String getInitialRoute ()
 
RenderMode getRenderMode ()
 
TransparencyMode getTransparencyMode ()
 
FlutterEngine provideFlutterEngine (@NonNull Context context)
 
FlutterEngine getFlutterEngine ()
 
PlatformPlugin providePlatformPlugin ( @Nullable Activity activity, @NonNull FlutterEngine flutterEngine)
 
void configureFlutterEngine (@NonNull FlutterEngine flutterEngine)
 
void cleanUpFlutterEngine (@NonNull FlutterEngine flutterEngine)
 
boolean shouldAttachEngineToActivity ()
 
boolean shouldHandleDeeplinking ()
 
void onFlutterSurfaceViewCreated (@NonNull FlutterSurfaceView flutterSurfaceView)
 
void onFlutterTextureViewCreated (@NonNull FlutterTextureView flutterTextureView)
 
void onFlutterUiDisplayed ()
 
void onFlutterUiNoLongerDisplayed ()
 
boolean shouldRestoreAndSaveState ()
 
void updateSystemUiOverlays ()
 
boolean shouldDispatchAppLifecycleState ()
 
boolean attachToEngineAutomatically ()
 
boolean popSystemNavigator ()
 
void setFrameworkHandlesBack (boolean frameworkHandlesBack)
 
- Public Member Functions inherited from io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host
Context getContext ()
 
boolean shouldHandleDeeplinking ()
 
Activity getActivity ()
 
Lifecycle getLifecycle ()
 
FlutterShellArgs getFlutterShellArgs ()
 
String getCachedEngineId ()
 
String getCachedEngineGroupId ()
 
boolean shouldDestroyEngineWithHost ()
 
void detachFromFlutterEngine ()
 
String getDartEntrypointFunctionName ()
 
String getDartEntrypointLibraryUri ()
 
List< String > getDartEntrypointArgs ()
 
String getAppBundlePath ()
 
String getInitialRoute ()
 
RenderMode getRenderMode ()
 
TransparencyMode getTransparencyMode ()
 
ExclusiveAppComponent< Activity > getExclusiveAppComponent ()
 
FlutterEngine provideFlutterEngine (@NonNull Context context)
 
PlatformPlugin providePlatformPlugin ( @Nullable Activity activity, @NonNull FlutterEngine flutterEngine)
 
void configureFlutterEngine (@NonNull FlutterEngine flutterEngine)
 
void cleanUpFlutterEngine (@NonNull FlutterEngine flutterEngine)
 
boolean shouldAttachEngineToActivity ()
 
void onFlutterSurfaceViewCreated (@NonNull FlutterSurfaceView flutterSurfaceView)
 
void onFlutterTextureViewCreated (@NonNull FlutterTextureView flutterTextureView)
 
void onFlutterUiDisplayed ()
 
void onFlutterUiNoLongerDisplayed ()
 
boolean shouldRestoreAndSaveState ()
 
void updateSystemUiOverlays ()
 
boolean shouldDispatchAppLifecycleState ()
 
boolean attachToEngineAutomatically ()
 
FlutterEngine provideFlutterEngine (@NonNull Context context)
 
void configureFlutterEngine (@NonNull FlutterEngine flutterEngine)
 
void cleanUpFlutterEngine (@NonNull FlutterEngine flutterEngine)
 
boolean popSystemNavigator ()
 
default void setFrameworkHandlesBack (boolean frameworkHandlesBack)
 
FlutterActivityAndFragmentDelegate createDelegate (FlutterActivityAndFragmentDelegate.Host host)
 

Static Public Member Functions

static FlutterFragment createDefault ()
 
static NewEngineFragmentBuilder withNewEngine ()
 
static CachedEngineFragmentBuilder withCachedEngine (@NonNull String engineId)
 
static NewEngineInGroupFragmentBuilder withNewEngineInGroup ( @NonNull String engineGroupId)
 

Static Public Attributes

static final int FLUTTER_VIEW_ID = View.generateViewId()
 

Static Protected Attributes

static final String ARG_DART_ENTRYPOINT = "dart_entrypoint"
 
static final String ARG_DART_ENTRYPOINT_URI = "dart_entrypoint_uri"
 
static final String ARG_DART_ENTRYPOINT_ARGS = "dart_entrypoint_args"
 
static final String ARG_INITIAL_ROUTE = "initial_route"
 
static final String ARG_HANDLE_DEEPLINKING = "handle_deeplinking"
 
static final String ARG_APP_BUNDLE_PATH = "app_bundle_path"
 
static final String ARG_SHOULD_DELAY_FIRST_ANDROID_VIEW_DRAW
 
static final String ARG_FLUTTER_INITIALIZATION_ARGS = "initialization_args"
 
static final String ARG_FLUTTERVIEW_RENDER_MODE = "flutterview_render_mode"
 
static final String ARG_FLUTTERVIEW_TRANSPARENCY_MODE = "flutterview_transparency_mode"
 
static final String ARG_SHOULD_ATTACH_ENGINE_TO_ACTIVITY
 
static final String ARG_CACHED_ENGINE_ID = "cached_engine_id"
 
static final String ARG_CACHED_ENGINE_GROUP_ID = "cached_engine_group_id"
 
static final String ARG_DESTROY_ENGINE_WITH_FRAGMENT = "destroy_engine_with_fragment"
 
static final String ARG_ENABLE_STATE_RESTORATION = "enable_state_restoration"
 
static final String ARG_SHOULD_AUTOMATICALLY_HANDLE_ON_BACK_PRESSED
 

Package Functions

void setDelegateFactory ( @NonNull FlutterActivityAndFragmentDelegate.DelegateFactory delegateFactory)
 
boolean isFlutterEngineInjected ()
 
boolean shouldDelayFirstAndroidViewDraw ()
 

Package Attributes

FlutterActivityAndFragmentDelegate delegate
 

Detailed Description

Fragment which displays a Flutter UI that takes up all available Fragment space.

Using a FlutterFragment requires forwarding a number of calls from an Activity to ensure that the internal Flutter app behaves as expected:

  1. onPostResume()
  2. onBackPressed()
  3. onRequestPermissionsResult(int, String[], int[])
  4. onNewIntent(Intent)
  5. onUserLeaveHint()

onBackPressed() does not need to be called through if the fragment is constructed by one of the builders with shouldAutomaticallyHandleOnBackPressed(true).

Additionally, when starting an Activity for a result from this Fragment, be sure to invoke Fragment#startActivityForResult(Intent, int) rather than android.app.Activity#startActivityForResult(Intent, int). If the Activity version of the method is invoked then this Fragment will never receive its Fragment#onActivityResult(int, int, Intent) callback.

If convenient, consider using a FlutterActivity instead of a FlutterFragment to avoid the work of forwarding calls.

FlutterFragment supports the use of an existing, cached io.flutter.embedding.engine.FlutterEngine. To use a cached io.flutter.embedding.engine.FlutterEngine, ensure that the io.flutter.embedding.engine.FlutterEngine is stored in io.flutter.embedding.engine.FlutterEngineCache and then use withCachedEngine(String) to build a FlutterFragment with the cached io.flutter.embedding.engine.FlutterEngine's ID.

It is generally recommended to use a cached io.flutter.embedding.engine.FlutterEngine to avoid a momentary delay when initializing a new io.flutter.embedding.engine.FlutterEngine. The two exceptions to using a cached FlutterEngine are:

The following illustrates how to pre-warm and cache a io.flutter.embedding.engine.FlutterEngine:


// Create and pre-warm a FlutterEngine.
FlutterEngineGroup group = new FlutterEngineGroup(context);
FlutterEngine flutterEngine = group.createAndRunDefaultEngine(context);
flutterEngine
.getDartExecutor()
.executeDartEntrypoint(DartEntrypoint.createDefault());

// Cache the pre-warmed FlutterEngine in the FlutterEngineCache.
FlutterEngineCache.getInstance().put("my_engine", flutterEngine);

If Flutter is needed in a location that can only use a View, consider using a io.flutter.embedding.android.FlutterView. Using a io.flutter.embedding.android.FlutterView requires forwarding some calls from an
Activity
, as well as forwarding lifecycle calls from an Activity or a Fragment.

Definition at line 97 of file FlutterFragment.java.

Constructor & Destructor Documentation

◆ FlutterFragment()

io.flutter.embedding.android.FlutterFragment.FlutterFragment ( )
inline

Definition at line 1020 of file FlutterFragment.java.

1020 {
1021 // Ensure that we at least have an empty Bundle of arguments so that we don't
1022 // need to continually check for null arguments before grabbing one.
1023 setArguments(new Bundle());
1024 }

Member Function Documentation

◆ attachToEngineAutomatically()

boolean io.flutter.embedding.android.FlutterFragment.attachToEngineAutomatically ( )
inline

Whether to automatically attach the FlutterView to the engine.

Returning false means that the task of attaching the FlutterView to the engine will be taken over by the host application.

Defaults to true.

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1654 of file FlutterFragment.java.

1654 {
1655 return true;
1656 }

◆ cleanUpFlutterEngine()

void io.flutter.embedding.android.FlutterFragment.cleanUpFlutterEngine ( @NonNull FlutterEngine  flutterEngine)
inline

Hook for the host to cleanup references that were established in configureFlutterEngine(FlutterEngine) before the host is destroyed or detached.

This method is called in onDetach().

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1539 of file FlutterFragment.java.

1539 {
1540 FragmentActivity attachedActivity = getActivity();
1541 if (attachedActivity instanceof FlutterEngineConfigurator) {
1542 ((FlutterEngineConfigurator) attachedActivity).cleanUpFlutterEngine(flutterEngine);
1543 }
1544 }

◆ configureFlutterEngine()

void io.flutter.embedding.android.FlutterFragment.configureFlutterEngine ( @NonNull FlutterEngine  flutterEngine)
inline

Configures a io.flutter.embedding.engine.FlutterEngine after its creation.

This method is called after provideFlutterEngine(Context), and after the given io.flutter.embedding.engine.FlutterEngine has been attached to the owning
FragmentActivity
. See io.flutter.embedding.engine.plugins.activity.ActivityControlSurface#attachToActivity( ExclusiveAppComponent, Lifecycle).

It is possible that the owning FragmentActivity opted not to connect itself as an io.flutter.embedding.engine.plugins.activity.ActivityControlSurface. In that case, any configuration, e.g., plugins, must not expect or depend upon an available Activity at the time that this method is invoked.

The default behavior of this method is to defer to the owning FragmentActivity as a io.flutter.embedding.android.FlutterEngineConfigurator. Subclasses can override this method if the subclass needs to override the FragmentActivity's behavior, or add to it.

Used by this FlutterFragment's FlutterActivityAndFragmentDelegate.Host

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1525 of file FlutterFragment.java.

1525 {
1526 FragmentActivity attachedActivity = getActivity();
1527 if (attachedActivity instanceof FlutterEngineConfigurator) {
1528 ((FlutterEngineConfigurator) attachedActivity).configureFlutterEngine(flutterEngine);
1529 }
1530 }

◆ createDefault()

static FlutterFragment io.flutter.embedding.android.FlutterFragment.createDefault ( )
inlinestatic

Creates a FlutterFragment with a default configuration.

FlutterFragment's default configuration creates a new io.flutter.embedding.engine.FlutterEngine within the FlutterFragment and uses the following settings:

  • Dart entrypoint: "main"
  • Initial route: "/"
  • Render mode: surface
  • Transparency mode: transparent

To use a new io.flutter.embedding.engine.FlutterEngine with different settings, use withNewEngine().

To use a cached io.flutter.embedding.engine.FlutterEngine instead of creating a new one, use withCachedEngine(String).

Definition at line 201 of file FlutterFragment.java.

201 {
202 return new NewEngineFragmentBuilder().build();
203 }

◆ createDelegate()

FlutterActivityAndFragmentDelegate io.flutter.embedding.android.FlutterFragment.createDelegate ( FlutterActivityAndFragmentDelegate.Host  host)
inline

Default delegate factory that creates a simple FlutterActivityAndFragmentDelegate instance.

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.DelegateFactory.

Definition at line 1007 of file FlutterFragment.java.

1008 {
1009 return new FlutterActivityAndFragmentDelegate(host);
1010 }
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service host
Definition: switches.h:74

◆ detachFromFlutterEngine()

void io.flutter.embedding.android.FlutterFragment.detachFromFlutterEngine ( )
inline

Callback called when the io.flutter.embedding.engine.FlutterEngine has been attached to by another activity before this activity was destroyed.

The expected behavior is for this activity to synchronously stop using the FlutterEngine to avoid lifecycle crosstalk with the new activity.

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1156 of file FlutterFragment.java.

1156 {
1157 Log.w(
1158 TAG,
1159 "FlutterFragment "
1160 + this
1161 + " connection to the engine "
1163 + " evicted by another attaching activity");
1164 if (delegate != null) {
1165 // Redundant calls are ok.
1168 }
1169 }
FlutterActivityAndFragmentDelegate delegate
void Log(const char *format,...) SK_PRINTF_LIKE(1
Definition: TestRunner.cpp:137

◆ getAppBundlePath()

String io.flutter.embedding.android.FlutterFragment.getAppBundlePath ( )
inline

A custom path to the bundle that contains this Flutter app's resources, e.g., Dart code snapshots.

When unspecified, the value is null, which defaults to the app bundle path defined in io.flutter.embedding.engine.loader.FlutterLoader#findAppBundlePath().

Used by this FlutterFragment's FlutterActivityAndFragmentDelegate.Host

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1397 of file FlutterFragment.java.

1397 {
1398 return getArguments().getString(ARG_APP_BUNDLE_PATH);
1399 }

◆ getCachedEngineGroupId()

String io.flutter.embedding.android.FlutterFragment.getCachedEngineGroupId ( )
inline

Returns the ID of a statically cached io.flutter.embedding.engine.FlutterEngineGroup to use within this FlutterFragment, or null if this FlutterFragment does not want to use a cached io.flutter.embedding.engine.FlutterEngineGroup.

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1312 of file FlutterFragment.java.

1312 {
1313 return getArguments().getString(ARG_CACHED_ENGINE_GROUP_ID, null);
1314 }

◆ getCachedEngineId()

String io.flutter.embedding.android.FlutterFragment.getCachedEngineId ( )
inline

Returns the ID of a statically cached io.flutter.embedding.engine.FlutterEngine to use within this FlutterFragment, or null if this FlutterFragment does not want to use a cached io.flutter.embedding.engine.FlutterEngine.

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1301 of file FlutterFragment.java.

1301 {
1302 return getArguments().getString(ARG_CACHED_ENGINE_ID, null);
1303 }

◆ getDartEntrypointArgs()

List< String > io.flutter.embedding.android.FlutterFragment.getDartEntrypointArgs ( )
inline

The Dart entrypoint arguments will be passed as a list of string to Dart's entrypoint function.

A value of null means do not pass any arguments to Dart's entrypoint function.

Subclasses may override this method to directly control the Dart entrypoint arguments.

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1368 of file FlutterFragment.java.

1368 {
1369 return getArguments().getStringArrayList(ARG_DART_ENTRYPOINT_ARGS);
1370 }

◆ getDartEntrypointFunctionName()

String io.flutter.embedding.android.FlutterFragment.getDartEntrypointFunctionName ( )
inline

Returns the name of the Dart method that this FlutterFragment should execute to start a Flutter app.

Defaults to "main".

Used by this FlutterFragment's FlutterActivityAndFragmentDelegate.Host

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1355 of file FlutterFragment.java.

1355 {
1356 return getArguments().getString(ARG_DART_ENTRYPOINT, "main");
1357 }

◆ getDartEntrypointLibraryUri()

String io.flutter.embedding.android.FlutterFragment.getDartEntrypointLibraryUri ( )
inline

Returns the library URI of the Dart method that this FlutterFragment should execute to start a Flutter app.

Defaults to null (example value: "package:foo/bar.dart").

Used by this FlutterFragment's FlutterActivityAndFragmentDelegate.Host

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1382 of file FlutterFragment.java.

1382 {
1383 return getArguments().getString(ARG_DART_ENTRYPOINT_URI);
1384 }

◆ getExclusiveAppComponent()

ExclusiveAppComponent< Activity > io.flutter.embedding.android.FlutterFragment.getExclusiveAppComponent ( )
inline

Returns the Android App Component exclusively attached to io.flutter.embedding.engine.FlutterEngine.

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1048 of file FlutterFragment.java.

1048 {
1049 return delegate;
1050 }

◆ getFlutterEngine()

FlutterEngine io.flutter.embedding.android.FlutterFragment.getFlutterEngine ( )
inline

Hook for subclasses to obtain a reference to the io.flutter.embedding.engine.FlutterEngine that is owned by this FlutterActivity.

Definition at line 1489 of file FlutterFragment.java.

◆ getFlutterShellArgs()

FlutterShellArgs io.flutter.embedding.android.FlutterFragment.getFlutterShellArgs ( )
inline

FlutterActivityAndFragmentDelegate.Host method that is used by FlutterActivityAndFragmentDelegate to obtain Flutter shell arguments when initializing Flutter.

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1288 of file FlutterFragment.java.

1288 {
1289 String[] flutterShellArgsArray = getArguments().getStringArray(ARG_FLUTTER_INITIALIZATION_ARGS);
1290 return new FlutterShellArgs(
1291 flutterShellArgsArray != null ? flutterShellArgsArray : new String[] {});
1292 }

◆ getInitialRoute()

String io.flutter.embedding.android.FlutterFragment.getInitialRoute ( )
inline

Returns the initial route that should be rendered within Flutter, once the Flutter app starts.

Defaults to null, which signifies a route of "/" in Flutter.

Used by this FlutterFragment's FlutterActivityAndFragmentDelegate.Host

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1410 of file FlutterFragment.java.

1410 {
1411 return getArguments().getString(ARG_INITIAL_ROUTE);
1412 }

◆ getRenderMode()

RenderMode io.flutter.embedding.android.FlutterFragment.getRenderMode ( )
inline

Returns the desired RenderMode for the io.flutter.embedding.android.FlutterView displayed in this FlutterFragment.

Defaults to RenderMode#surface.

Used by this FlutterFragment's FlutterActivityAndFragmentDelegate.Host

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1424 of file FlutterFragment.java.

1424 {
1425 String renderModeName =
1426 getArguments().getString(ARG_FLUTTERVIEW_RENDER_MODE, RenderMode.surface.name());
1427 return RenderMode.valueOf(renderModeName);
1428 }

◆ getTransparencyMode()

TransparencyMode io.flutter.embedding.android.FlutterFragment.getTransparencyMode ( )
inline

Returns the desired TransparencyMode for the io.flutter.embedding.android.FlutterView displayed in this FlutterFragment.

Defaults to TransparencyMode#transparent.

Used by this FlutterFragment's FlutterActivityAndFragmentDelegate.Host

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1440 of file FlutterFragment.java.

1440 {
1441 String transparencyModeName =
1442 getArguments()
1443 .getString(ARG_FLUTTERVIEW_TRANSPARENCY_MODE, TransparencyMode.transparent.name());
1444 return TransparencyMode.valueOf(transparencyModeName);
1445 }

◆ isFlutterEngineInjected()

boolean io.flutter.embedding.android.FlutterFragment.isFlutterEngineInjected ( )
inlinepackage

Returns true a FlutterEngine was explicitly created and injected into the
FlutterFragment
rather than one that was created implicitly in the FlutterFragment.

Definition at line 1320 of file FlutterFragment.java.

1320 {
1321 return delegate.isFlutterEngineFromHost();
1322 }

◆ onActivityResult()

void io.flutter.embedding.android.FlutterFragment.onActivityResult ( int  requestCode,
int  resultCode,
Intent  data 
)
inline

A result has been returned after an invocation of Fragment#startActivityForResult(Intent, int).

Parameters
requestCoderequest code sent with Fragment#startActivityForResult(Intent, int)
resultCodecode representing the result of the Activity that was launched
dataany corresponding return data, held within an Intent

Definition at line 1246 of file FlutterFragment.java.

1246 {
1247 if (stillAttachedForEvent("onActivityResult")) {
1248 delegate.onActivityResult(requestCode, resultCode, data);
1249 }
1250 }
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ onAttach()

void io.flutter.embedding.android.FlutterFragment.onAttach ( @NonNull Context  context)
inline

Definition at line 1053 of file FlutterFragment.java.

1053 {
1054 super.onAttach(context);
1055 delegate = delegateFactory.createDelegate(this);
1056 delegate.onAttach(context);
1057 if (getArguments().getBoolean(ARG_SHOULD_AUTOMATICALLY_HANDLE_ON_BACK_PRESSED, false)) {
1058 requireActivity().getOnBackPressedDispatcher().addCallback(this, onBackPressedCallback);
1059 // When Android handles a back gesture, it pops an Activity or goes back
1060 // to the home screen. When Flutter handles a back gesture, it pops a
1061 // route inside of the Flutter part of the app. By default, Android
1062 // handles back gestures, so this callback is disabled. If, for example,
1063 // the Flutter app has routes for which it wants to handle the back
1064 // gesture, then it will enable this callback using
1065 // setFrameworkHandlesBack.
1066 onBackPressedCallback.setEnabled(false);
1067 }
1068 context.registerComponentCallbacks(this);
1069 }
static final String ARG_SHOULD_AUTOMATICALLY_HANDLE_ON_BACK_PRESSED

◆ onBackPressed()

void io.flutter.embedding.android.FlutterFragment.onBackPressed ( )
inline

The hardware back button was pressed.

If the fragment uses shouldAutomaticallyHandleOnBackPressed(true), this method should not be called through. It will be called automatically instead.

See android.app.Activity#onBackPressed()

Definition at line 1229 of file FlutterFragment.java.

1229 {
1230 if (stillAttachedForEvent("onBackPressed")) {
1232 }
1233 }

◆ onCreate()

void io.flutter.embedding.android.FlutterFragment.onCreate ( @Nullable Bundle  savedInstanceState)
inline

Definition at line 1072 of file FlutterFragment.java.

1072 {
1073 super.onCreate(savedInstanceState);
1074 delegate.onRestoreInstanceState(savedInstanceState);
1075 }

◆ onCreateView()

View io.flutter.embedding.android.FlutterFragment.onCreateView ( LayoutInflater  inflater,
@Nullable ViewGroup  container,
@Nullable Bundle  savedInstanceState 
)
inline

Definition at line 1079 of file FlutterFragment.java.

1080 {
1081 return delegate.onCreateView(
1082 inflater,
1083 container,
1084 savedInstanceState,
1085 /*flutterViewId=*/ FLUTTER_VIEW_ID,
1087 }
View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState, int flutterViewId, boolean shouldDelayFirstAndroidViewDraw)

◆ onDestroyView()

void io.flutter.embedding.android.FlutterFragment.onDestroyView ( )
inline

Definition at line 1137 of file FlutterFragment.java.

1137 {
1138 super.onDestroyView();
1139 requireView()
1140 .getViewTreeObserver()
1141 .removeOnWindowFocusChangeListener(onWindowFocusChangeListener);
1142 if (stillAttachedForEvent("onDestroyView")) {
1144 }
1145 }

◆ onDetach()

void io.flutter.embedding.android.FlutterFragment.onDetach ( )
inline

Definition at line 1172 of file FlutterFragment.java.

1172 {
1173 getContext().unregisterComponentCallbacks(this);
1174 super.onDetach();
1175 if (delegate != null) {
1177 delegate.release();
1178 delegate = null;
1179 } else {
1180 Log.v(TAG, "FlutterFragment " + this + " onDetach called after release.");
1181 }
1182 }

◆ onFlutterSurfaceViewCreated()

void io.flutter.embedding.android.FlutterFragment.onFlutterSurfaceViewCreated ( @NonNull FlutterSurfaceView  flutterSurfaceView)
inline

Invoked by this delegate when the FlutterSurfaceView that renders the Flutter UI is initially instantiated.

This method is only invoked if the io.flutter.embedding.android.FlutterView.RenderMode is set to io.flutter.embedding.android.FlutterView.RenderMode#surface. Otherwise, onFlutterTextureViewCreated(FlutterTextureView) is invoked.

This method is invoked before the given FlutterSurfaceView is attached to the View hierarchy. Implementers should not attempt to climb the View hierarchy or make assumptions about relationships with other Views.

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1567 of file FlutterFragment.java.

1567 {
1568 // Hook for subclasses.
1569 }

◆ onFlutterTextureViewCreated()

void io.flutter.embedding.android.FlutterFragment.onFlutterTextureViewCreated ( @NonNull FlutterTextureView  flutterTextureView)
inline

Invoked by this delegate when the FlutterTextureView that renders the Flutter UI is initially instantiated.

This method is only invoked if the io.flutter.embedding.android.FlutterView.RenderMode is set to io.flutter.embedding.android.FlutterView.RenderMode#texture. Otherwise, onFlutterSurfaceViewCreated(FlutterSurfaceView) is invoked.

This method is invoked before the given FlutterTextureView is attached to the View hierarchy. Implementers should not attempt to climb the View hierarchy or make assumptions about relationships with other Views.

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1572 of file FlutterFragment.java.

1572 {
1573 // Hook for subclasses.
1574 }

◆ onFlutterUiDisplayed()

void io.flutter.embedding.android.FlutterFragment.onFlutterUiDisplayed ( )
inline

Invoked after the io.flutter.embedding.android.FlutterView within this
FlutterFragment
starts rendering pixels to the screen.

This method forwards onFlutterUiDisplayed() to its attached Activity, if the attached Activity implements FlutterUiDisplayListener.

Subclasses that override this method must call through to the super method.

Used by this FlutterFragment's FlutterActivityAndFragmentDelegate.Host

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1588 of file FlutterFragment.java.

1588 {
1589 FragmentActivity attachedActivity = getActivity();
1590 if (attachedActivity instanceof FlutterUiDisplayListener) {
1591 ((FlutterUiDisplayListener) attachedActivity).onFlutterUiDisplayed();
1592 }
1593 }

◆ onFlutterUiNoLongerDisplayed()

void io.flutter.embedding.android.FlutterFragment.onFlutterUiNoLongerDisplayed ( )
inline

Invoked after the io.flutter.embedding.android.FlutterView within this
FlutterFragment
stops rendering pixels to the screen.

This method forwards onFlutterUiNoLongerDisplayed() to its attached
Activity
, if the attached Activity implements FlutterUiDisplayListener.

Subclasses that override this method must call through to the super method.

Used by this FlutterFragment's FlutterActivityAndFragmentDelegate.Host

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1607 of file FlutterFragment.java.

1607 {
1608 FragmentActivity attachedActivity = getActivity();
1609 if (attachedActivity instanceof FlutterUiDisplayListener) {
1610 ((FlutterUiDisplayListener) attachedActivity).onFlutterUiNoLongerDisplayed();
1611 }
1612 }

◆ onNewIntent()

void io.flutter.embedding.android.FlutterFragment.onNewIntent ( @NonNull Intent  intent)
inline

A new Intent was received by the android.app.Activity that currently owns this Fragment.

See android.app.Activity#onNewIntent(Intent)

Parameters
intentnew Intent

Definition at line 1214 of file FlutterFragment.java.

1214 {
1215 if (stillAttachedForEvent("onNewIntent")) {
1216 delegate.onNewIntent(intent);
1217 }
1218 }

◆ onPause()

void io.flutter.embedding.android.FlutterFragment.onPause ( )
inline

Definition at line 1115 of file FlutterFragment.java.

1115 {
1116 super.onPause();
1117 if (stillAttachedForEvent("onPause")) {
1118 delegate.onPause();
1119 }
1120 }

◆ onPostResume()

void io.flutter.embedding.android.FlutterFragment.onPostResume ( )
inline

Definition at line 1108 of file FlutterFragment.java.

1108 {
1109 if (stillAttachedForEvent("onPostResume")) {
1111 }
1112 }

◆ onRequestPermissionsResult()

void io.flutter.embedding.android.FlutterFragment.onRequestPermissionsResult ( int  requestCode,
@NonNull String[]  permissions,
@NonNull int[]  grantResults 
)
inline

The result of a permission request has been received.

See android.app.Activity#onRequestPermissionsResult(int, String[], int[])

Parameters
requestCodeidentifier passed with the initial permission request
permissionspermissions that were requested
grantResultspermission grants or denials

Definition at line 1196 of file FlutterFragment.java.

1197 {
1198 if (stillAttachedForEvent("onRequestPermissionsResult")) {
1199 delegate.onRequestPermissionsResult(requestCode, permissions, grantResults);
1200 }
1201 }
void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)

◆ onResume()

void io.flutter.embedding.android.FlutterFragment.onResume ( )
inline

Definition at line 1098 of file FlutterFragment.java.

1098 {
1099 super.onResume();
1100 if (stillAttachedForEvent("onResume")) {
1102 }
1103 }

◆ onSaveInstanceState()

void io.flutter.embedding.android.FlutterFragment.onSaveInstanceState ( Bundle  outState)
inline

Definition at line 1148 of file FlutterFragment.java.

1148 {
1149 super.onSaveInstanceState(outState);
1150 if (stillAttachedForEvent("onSaveInstanceState")) {
1151 delegate.onSaveInstanceState(outState);
1152 }
1153 }

◆ onStart()

void io.flutter.embedding.android.FlutterFragment.onStart ( )
inline

Definition at line 1090 of file FlutterFragment.java.

1090 {
1091 super.onStart();
1092 if (stillAttachedForEvent("onStart")) {
1093 delegate.onStart();
1094 }
1095 }

◆ onStop()

void io.flutter.embedding.android.FlutterFragment.onStop ( )
inline

Definition at line 1123 of file FlutterFragment.java.

1123 {
1124 super.onStop();
1125 if (stillAttachedForEvent("onStop")) {
1126 delegate.onStop();
1127 }
1128 }

◆ onTrimMemory()

void io.flutter.embedding.android.FlutterFragment.onTrimMemory ( int  level)
inline

Callback invoked when memory is low.

This implementation forwards a memory pressure warning to the running Flutter app.

Parameters
levellevel

Definition at line 1275 of file FlutterFragment.java.

1275 {
1276 if (stillAttachedForEvent("onTrimMemory")) {
1278 }
1279 }

◆ onUserLeaveHint()

void io.flutter.embedding.android.FlutterFragment.onUserLeaveHint ( )
inline

The android.app.Activity that owns this Fragment is about to go to the background as the result of a user's choice/action, i.e., not as the result of an OS decision.

See android.app.Activity#onUserLeaveHint()

Definition at line 1259 of file FlutterFragment.java.

1259 {
1260 if (stillAttachedForEvent("onUserLeaveHint")) {
1262 }
1263 }

◆ onViewCreated()

void io.flutter.embedding.android.FlutterFragment.onViewCreated ( View  view,
Bundle  savedInstanceState 
)
inline

Definition at line 1131 of file FlutterFragment.java.

1131 {
1132 super.onViewCreated(view, savedInstanceState);
1133 view.getViewTreeObserver().addOnWindowFocusChangeListener(onWindowFocusChangeListener);
1134 }

◆ popSystemNavigator()

boolean io.flutter.embedding.android.FlutterFragment.popSystemNavigator ( )
inline

Allow implementer to customize the behavior needed when the Flutter framework calls to pop the Android-side navigation stack.

Returns
true if the implementation consumed the pop signal. If false, a default behavior of finishing the activity or sending the signal to androidx.activity.OnBackPressedDispatcher will be executed.

Avoid overriding this method when using
shouldAutomaticallyHandleOnBackPressed(true)
. If you do, you must always return
super.popSystemNavigator()
rather than return false. Otherwise the navigation behavior will recurse infinitely between this method and onBackPressed(), breaking navigation.

Implements io.flutter.plugin.platform.PlatformPlugin.PlatformPluginDelegate.

Definition at line 1667 of file FlutterFragment.java.

1667 {
1668 if (getArguments().getBoolean(ARG_SHOULD_AUTOMATICALLY_HANDLE_ON_BACK_PRESSED, false)) {
1669 FragmentActivity activity = getActivity();
1670 if (activity != null) {
1671 // Unless we disable the callback, the dispatcher call will trigger it. This will then
1672 // trigger the fragment's onBackPressed() implementation, which will call through to the
1673 // dart side and likely call back through to this method, creating an infinite call loop.
1674 boolean enabledAtStart = onBackPressedCallback.isEnabled();
1675 if (enabledAtStart) {
1676 onBackPressedCallback.setEnabled(false);
1677 }
1678 activity.getOnBackPressedDispatcher().onBackPressed();
1679 if (enabledAtStart) {
1680 onBackPressedCallback.setEnabled(true);
1681 }
1682 return true;
1683 }
1684 }
1685 // Hook for subclass. No-op if returns false.
1686 return false;
1687 }

◆ provideFlutterEngine()

FlutterEngine io.flutter.embedding.android.FlutterFragment.provideFlutterEngine ( @NonNull Context  context)
inline

Hook for subclasses to return a io.flutter.embedding.engine.FlutterEngine with whatever configuration is desired.

By default this method defers to this FlutterFragment's surrounding
Activity
, if that Activity implements io.flutter.embedding.android.FlutterEngineProvider. If this method is overridden, the surrounding Activity will no longer be given an opportunity to provide a io.flutter.embedding.engine.FlutterEngine, unless the subclass explicitly implements that behavior.

Consider returning a cached io.flutter.embedding.engine.FlutterEngine instance from this method to avoid the typical warm-up time that a new io.flutter.embedding.engine.FlutterEngine instance requires.

If null is returned then a new default io.flutter.embedding.engine.FlutterEngine will be created to back this FlutterFragment.

Used by this FlutterFragment's FlutterActivityAndFragmentDelegate.Host

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1469 of file FlutterFragment.java.

1469 {
1470 // Defer to the FragmentActivity that owns us to see if it wants to provide a
1471 // FlutterEngine.
1472 FlutterEngine flutterEngine = null;
1473 FragmentActivity attachedActivity = getActivity();
1474 if (attachedActivity instanceof FlutterEngineProvider) {
1475 // Defer to the Activity that owns us to provide a FlutterEngine.
1476 Log.v(TAG, "Deferring to attached Activity to provide a FlutterEngine.");
1477 FlutterEngineProvider flutterEngineProvider = (FlutterEngineProvider) attachedActivity;
1478 flutterEngine = flutterEngineProvider.provideFlutterEngine(getContext());
1479 }
1480
1481 return flutterEngine;
1482 }

◆ providePlatformPlugin()

PlatformPlugin io.flutter.embedding.android.FlutterFragment.providePlatformPlugin ( @Nullable Activity  activity,
@NonNull FlutterEngine  flutterEngine 
)
inline

Hook for the host to create/provide a PlatformPlugin if the associated Flutter experience should control system chrome.

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1495 of file FlutterFragment.java.

1496 {
1497 if (activity != null) {
1498 return new PlatformPlugin(getActivity(), flutterEngine.getPlatformChannel(), this);
1499 } else {
1500 return null;
1501 }
1502 }

◆ setDelegateFactory()

void io.flutter.embedding.android.FlutterFragment.setDelegateFactory ( @NonNull FlutterActivityAndFragmentDelegate.DelegateFactory  delegateFactory)
inlinepackage

This method exists so that JVM tests can ensure that a delegate exists without putting this Fragment through any lifecycle events, because JVM tests cannot handle executing any lifecycle methods, at the time of writing this.

The testing infrastructure should be upgraded to make FlutterFragment tests easy to write while exercising real lifecycle methods. At such a time, this method should be removed.

Definition at line 1037 of file FlutterFragment.java.

1038 {
1039 this.delegateFactory = delegateFactory;
1040 delegate = delegateFactory.createDelegate(this);
1041 }

◆ setFrameworkHandlesBack()

void io.flutter.embedding.android.FlutterFragment.setFrameworkHandlesBack ( boolean  frameworkHandlesBack)
inline

The Flutter application would or would not like to handle navigation pop events itself.

Relevant for registering and unregistering the app's OnBackInvokedCallback for the Predictive Back feature, for example as in io.flutter.embedding.android.FlutterActivity.

Implements io.flutter.plugin.platform.PlatformPlugin.PlatformPluginDelegate.

Definition at line 1690 of file FlutterFragment.java.

1690 {
1691 if (!getArguments().getBoolean(ARG_SHOULD_AUTOMATICALLY_HANDLE_ON_BACK_PRESSED, false)) {
1692 return;
1693 }
1694 onBackPressedCallback.setEnabled(frameworkHandlesBack);
1695 }

◆ shouldAttachEngineToActivity()

boolean io.flutter.embedding.android.FlutterFragment.shouldAttachEngineToActivity ( )
inline

◆ shouldDelayFirstAndroidViewDraw()

boolean io.flutter.embedding.android.FlutterFragment.shouldDelayFirstAndroidViewDraw ( )
inlinepackage

Definition at line 1699 of file FlutterFragment.java.

1699 {
1700 return getArguments().getBoolean(ARG_SHOULD_DELAY_FIRST_ANDROID_VIEW_DRAW);
1701 }

◆ shouldDestroyEngineWithHost()

boolean io.flutter.embedding.android.FlutterFragment.shouldDestroyEngineWithHost ( )
inline

Returns false if the io.flutter.embedding.engine.FlutterEngine within this
FlutterFragment
should outlive the FlutterFragment, itself.

Defaults to true if no custom is provided, false if a custom FlutterEngine is provided.

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1332 of file FlutterFragment.java.

1332 {
1333 boolean explicitDestructionRequested =
1334 getArguments().getBoolean(ARG_DESTROY_ENGINE_WITH_FRAGMENT, false);
1335 if (getCachedEngineId() != null || delegate.isFlutterEngineFromHost()) {
1336 // Only destroy a cached engine if explicitly requested by app developer.
1337 return explicitDestructionRequested;
1338 } else {
1339 // If this Fragment created the FlutterEngine, destroy it by default unless
1340 // explicitly requested not to.
1341 return getArguments().getBoolean(ARG_DESTROY_ENGINE_WITH_FRAGMENT, true);
1342 }
1343 }

◆ shouldDispatchAppLifecycleState()

boolean io.flutter.embedding.android.FlutterFragment.shouldDispatchAppLifecycleState ( )
inline

Give the host application a chance to take control of the app lifecycle events.

Return false means the host application dispatches these app lifecycle events, while return true means the engine dispatches these events.

Defaults to true.

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1641 of file FlutterFragment.java.

1641 {
1642 return true;
1643 }

◆ shouldHandleDeeplinking()

boolean io.flutter.embedding.android.FlutterFragment.shouldHandleDeeplinking ( )
inline

Whether to handle the deeplinking from the Intent automatically if the
getInitialRoute
returns null.

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1562 of file FlutterFragment.java.

1562 {
1563 return getArguments().getBoolean(ARG_HANDLE_DEEPLINKING);
1564 }

◆ shouldRestoreAndSaveState()

boolean io.flutter.embedding.android.FlutterFragment.shouldRestoreAndSaveState ( )
inline

Whether state restoration is enabled.

When this returns true, the instance state provided to
onRestoreInstanceState(Bundle)
will be forwarded to the framework via the
RestorationChannel
and during onSaveInstanceState(Bundle) the current framework instance state obtained from RestorationChannel will be stored in the provided bundle.

This defaults to true, unless a cached engine is used.

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1615 of file FlutterFragment.java.

1615 {
1616 if (getArguments().containsKey(ARG_ENABLE_STATE_RESTORATION)) {
1617 return getArguments().getBoolean(ARG_ENABLE_STATE_RESTORATION);
1618 }
1619 if (getCachedEngineId() != null) {
1620 return false;
1621 }
1622 return true;
1623 }

◆ updateSystemUiOverlays()

void io.flutter.embedding.android.FlutterFragment.updateSystemUiOverlays ( )
inline

Refreshes Android's window system UI (AKA system chrome) to match Flutter's desired system chrome style.

This is useful when using the splash screen API available in Android 12.
SplashScreenView#remove
resets the system UI colors to the values set prior to the execution of the Dart entrypoint. As a result, the values set from Dart are reverted by this API. To workaround this issue, call this method after removing the splash screen with
SplashScreenView#remove
.

Implements io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host.

Definition at line 1626 of file FlutterFragment.java.

◆ withCachedEngine()

static CachedEngineFragmentBuilder io.flutter.embedding.android.FlutterFragment.withCachedEngine ( @NonNull String  engineId)
inlinestatic

Returns a CachedEngineFragmentBuilder to create a FlutterFragment with a cached io.flutter.embedding.engine.FlutterEngine in io.flutter.embedding.engine.FlutterEngineCache.

An IllegalStateException will be thrown during the lifecycle of the
FlutterFragment
if a cached io.flutter.embedding.engine.FlutterEngine is requested but does not exist in the cache.

To create a FlutterFragment that uses a new io.flutter.embedding.engine.FlutterEngine, use createDefault() or withNewEngine().

Definition at line 514 of file FlutterFragment.java.

514 {
515 return new CachedEngineFragmentBuilder(engineId);
516 }

◆ withNewEngine()

static NewEngineFragmentBuilder io.flutter.embedding.android.FlutterFragment.withNewEngine ( )
inlinestatic

Returns a NewEngineFragmentBuilder to create a FlutterFragment with a new io.flutter.embedding.engine.FlutterEngine and a desired engine configuration.

Definition at line 210 of file FlutterFragment.java.

210 {
211 return new NewEngineFragmentBuilder();
212 }

◆ withNewEngineInGroup()

static NewEngineInGroupFragmentBuilder io.flutter.embedding.android.FlutterFragment.withNewEngineInGroup ( @NonNull String  engineGroupId)
inlinestatic

Returns a NewEngineInGroupFragmentBuilder to create a FlutterFragment with a cached io.flutter.embedding.engine.FlutterEngineGroup in io.flutter.embedding.engine.FlutterEngineGroupCache.

An IllegalStateException will be thrown during the lifecycle of the
FlutterFragment
if a cached io.flutter.embedding.engine.FlutterEngineGroup is requested but does not exist in the io.flutter.embedding.engine.FlutterEngineGroupCache.

Definition at line 757 of file FlutterFragment.java.

758 {
759 return new NewEngineInGroupFragmentBuilder(engineGroupId);
760 }

Member Data Documentation

◆ ARG_APP_BUNDLE_PATH

final String io.flutter.embedding.android.FlutterFragment.ARG_APP_BUNDLE_PATH = "app_bundle_path"
staticprotected

Path to Flutter's Dart code.

Definition at line 122 of file FlutterFragment.java.

◆ ARG_CACHED_ENGINE_GROUP_ID

final String io.flutter.embedding.android.FlutterFragment.ARG_CACHED_ENGINE_GROUP_ID = "cached_engine_group_id"
staticprotected

Definition at line 149 of file FlutterFragment.java.

◆ ARG_CACHED_ENGINE_ID

final String io.flutter.embedding.android.FlutterFragment.ARG_CACHED_ENGINE_ID = "cached_engine_id"
staticprotected

The ID of a io.flutter.embedding.engine.FlutterEngine cached in io.flutter.embedding.engine.FlutterEngineCache that will be used within the created
FlutterFragment
.

Definition at line 147 of file FlutterFragment.java.

◆ ARG_DART_ENTRYPOINT

final String io.flutter.embedding.android.FlutterFragment.ARG_DART_ENTRYPOINT = "dart_entrypoint"
staticprotected

The Dart entrypoint method name that is executed upon initialization.

Definition at line 112 of file FlutterFragment.java.

◆ ARG_DART_ENTRYPOINT_ARGS

final String io.flutter.embedding.android.FlutterFragment.ARG_DART_ENTRYPOINT_ARGS = "dart_entrypoint_args"
staticprotected

The Dart entrypoint arguments that is executed upon initialization.

Definition at line 116 of file FlutterFragment.java.

◆ ARG_DART_ENTRYPOINT_URI

final String io.flutter.embedding.android.FlutterFragment.ARG_DART_ENTRYPOINT_URI = "dart_entrypoint_uri"
staticprotected

The Dart entrypoint method's URI that is executed upon initialization.

Definition at line 114 of file FlutterFragment.java.

◆ ARG_DESTROY_ENGINE_WITH_FRAGMENT

final String io.flutter.embedding.android.FlutterFragment.ARG_DESTROY_ENGINE_WITH_FRAGMENT = "destroy_engine_with_fragment"
staticprotected

True if the io.flutter.embedding.engine.FlutterEngine in the created
FlutterFragment
should be destroyed when the FlutterFragment is destroyed, false if the io.flutter.embedding.engine.FlutterEngine should outlive the
FlutterFragment
.

Definition at line 157 of file FlutterFragment.java.

◆ ARG_ENABLE_STATE_RESTORATION

final String io.flutter.embedding.android.FlutterFragment.ARG_ENABLE_STATE_RESTORATION = "enable_state_restoration"
staticprotected

True if the framework state in the engine attached to this engine should be stored and restored when this fragment is created and destroyed.

Definition at line 162 of file FlutterFragment.java.

◆ ARG_FLUTTER_INITIALIZATION_ARGS

final String io.flutter.embedding.android.FlutterFragment.ARG_FLUTTER_INITIALIZATION_ARGS = "initialization_args"
staticprotected

Flutter shell arguments.

Definition at line 128 of file FlutterFragment.java.

◆ ARG_FLUTTERVIEW_RENDER_MODE

final String io.flutter.embedding.android.FlutterFragment.ARG_FLUTTERVIEW_RENDER_MODE = "flutterview_render_mode"
staticprotected

RenderMode to be used for the io.flutter.embedding.android.FlutterView in this FlutterFragment

Definition at line 133 of file FlutterFragment.java.

◆ ARG_FLUTTERVIEW_TRANSPARENCY_MODE

final String io.flutter.embedding.android.FlutterFragment.ARG_FLUTTERVIEW_TRANSPARENCY_MODE = "flutterview_transparency_mode"
staticprotected

TransparencyMode to be used for the io.flutter.embedding.android.FlutterView in this FlutterFragment

Definition at line 138 of file FlutterFragment.java.

◆ ARG_HANDLE_DEEPLINKING

final String io.flutter.embedding.android.FlutterFragment.ARG_HANDLE_DEEPLINKING = "handle_deeplinking"
staticprotected

Whether the activity delegate should handle the deeplinking request.

Definition at line 120 of file FlutterFragment.java.

◆ ARG_INITIAL_ROUTE

final String io.flutter.embedding.android.FlutterFragment.ARG_INITIAL_ROUTE = "initial_route"
staticprotected

Initial Flutter route that is rendered in a Navigator widget.

Definition at line 118 of file FlutterFragment.java.

◆ ARG_SHOULD_ATTACH_ENGINE_TO_ACTIVITY

final String io.flutter.embedding.android.FlutterFragment.ARG_SHOULD_ATTACH_ENGINE_TO_ACTIVITY
staticprotected
Initial value:
=
"should_attach_engine_to_activity"

See shouldAttachEngineToActivity().

Definition at line 140 of file FlutterFragment.java.

◆ ARG_SHOULD_AUTOMATICALLY_HANDLE_ON_BACK_PRESSED

final String io.flutter.embedding.android.FlutterFragment.ARG_SHOULD_AUTOMATICALLY_HANDLE_ON_BACK_PRESSED
staticprotected
Initial value:
=
"should_automatically_handle_on_back_pressed"

True if the fragment should receive onBackPressed() events automatically, without requiring an explicit activity call through.

Definition at line 167 of file FlutterFragment.java.

◆ ARG_SHOULD_DELAY_FIRST_ANDROID_VIEW_DRAW

final String io.flutter.embedding.android.FlutterFragment.ARG_SHOULD_DELAY_FIRST_ANDROID_VIEW_DRAW
staticprotected
Initial value:
=
"should_delay_first_android_view_draw"

Whether to delay the Android drawing pass till after the Flutter UI has been displayed.

Definition at line 124 of file FlutterFragment.java.

◆ delegate

FlutterActivityAndFragmentDelegate io.flutter.embedding.android.FlutterFragment.delegate
package

Definition at line 1002 of file FlutterFragment.java.

◆ FLUTTER_VIEW_ID

final int io.flutter.embedding.android.FlutterFragment.FLUTTER_VIEW_ID = View.generateViewId()
static

The ID of the FlutterView created by this activity.

This ID can be used to lookup FlutterView in the Android view hierarchy. For more, see android.view.View#findViewById.

Definition at line 107 of file FlutterFragment.java.


The documentation for this class was generated from the following file: