Class FlutterFragment
- All Implemented Interfaces:
ComponentCallbacks,ComponentCallbacks2,View.OnCreateContextMenuListener,androidx.activity.result.ActivityResultCaller,androidx.lifecycle.HasDefaultViewModelProviderFactory,androidx.lifecycle.LifecycleOwner,androidx.lifecycle.ViewModelStoreOwner,androidx.savedstate.SavedStateRegistryOwner,io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.DelegateFactory,FlutterEngineConfigurator,FlutterEngineProvider,PlatformPlugin.PlatformPluginDelegate
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:
onPostResume()onBackPressed()onRequestPermissionsResult(int, String[], int[])onNewIntent(Intent)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 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 FlutterEngine. To use a cached FlutterEngine, ensure that the FlutterEngine is stored in FlutterEngineCache and then use withCachedEngine(String) to
build a FlutterFragment with the cached FlutterEngine's ID.
It is generally recommended to use a cached FlutterEngine
to avoid a momentary delay when initializing a new FlutterEngine. The two exceptions to using a cached FlutterEngine are:
- When
FlutterFragmentis in the firstActivitydisplayed by the app, because pre-warming aFlutterEnginewould have no impact in this situation. - When you are unsure when/if you will need to display a Flutter experience.
The following illustrates how to pre-warm and cache a 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 FlutterView. Using a FlutterView requires forwarding some calls from an
Activity, as well as forwarding lifecycle calls from an Activity or a Fragment.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder that creates a newFlutterFragmentthat uses a cachedFlutterEnginewithargumentsthat correspond to the values set on thisBuilder.static classBuilder that creates a newFlutterFragmentwithargumentsthat correspond to the values set on thisNewEngineFragmentBuilder.static classBuilder that creates a newFlutterFragmentthat uses a cachedFlutterEngineGroupto create a newFlutterEnginewithargumentsthat correspond to the values set on thisBuilder.Nested classes/interfaces inherited from class androidx.fragment.app.Fragment
androidx.fragment.app.Fragment.InstantiationException, androidx.fragment.app.Fragment.SavedState -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringPath to Flutter's Dart code.protected static final Stringprotected static final StringThe ID of aFlutterEnginecached inFlutterEngineCachethat will be used within the createdFlutterFragment.protected static final StringThe Dart entrypoint method name that is executed upon initialization.protected static final StringThe Dart entrypoint arguments that is executed upon initialization.protected static final StringThe Dart entrypoint method's URI that is executed upon initialization.protected static final StringTrue if theFlutterEnginein the createdFlutterFragmentshould be destroyed when theFlutterFragmentis destroyed, false if theFlutterEngineshould outlive theFlutterFragment.protected static final StringTrue if the framework state in the engine attached to this engine should be stored and restored when this fragment is created and destroyed.protected static final StringFlutter shell arguments.protected static final Stringprotected static final Stringprotected static final StringWhether the activity delegate should handle the deeplinking request.protected static final StringInitial Flutter route that is rendered in a Navigator widget.protected static final Stringprotected static final StringTrue if the fragment should receiveonBackPressed()events automatically, without requiring an explicit activity call through.protected static final StringWhether to delay the Android drawing pass till after the Flutter UI has been displayed.static final intThe ID of theFlutterViewcreated by this activity.Fields inherited from class androidx.fragment.app.Fragment
mPreviousWhoFields inherited from interface android.content.ComponentCallbacks2
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether to automatically attach theFlutterViewto the engine.voidcleanUpFlutterEngine(FlutterEngine flutterEngine) Hook for the host to cleanup references that were established inconfigureFlutterEngine(FlutterEngine)before the host is destroyed or detached.voidconfigureFlutterEngine(FlutterEngine flutterEngine) Configures aFlutterEngineafter its creation.static FlutterFragmentCreates aFlutterFragmentwith a default configuration.io.flutter.embedding.android.FlutterActivityAndFragmentDelegatecreateDelegate(io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host host) Default delegate factory that creates a simple FlutterActivityAndFragmentDelegate instance.voidA custom path to the bundle that contains this Flutter app's resources, e.g., Dart code snapshots.booleanReturns the ID of a statically cachedFlutterEngineGroupto use within thisFlutterFragment, ornullif thisFlutterFragmentdoes not want to use a cachedFlutterEngineGroup.Returns the ID of a statically cachedFlutterEngineto use within thisFlutterFragment, ornullif thisFlutterFragmentdoes not want to use a cachedFlutterEngine.The Dart entrypoint arguments will be passed as a list of string to Dart's entrypoint function.Returns the name of the Dart method that thisFlutterFragmentshould execute to start a Flutter app.Returns the library URI of the Dart method that thisFlutterFragmentshould execute to start a Flutter app.Returns the Android App Component exclusively attached toFlutterEngine.Hook for subclasses to obtain a reference to theFlutterEnginethat is owned by thisFlutterActivity.FlutterActivityAndFragmentDelegate.Hostmethod that is used byFlutterActivityAndFragmentDelegateto obtain Flutter shell arguments when initializing Flutter.Returns the initial route that should be rendered within Flutter, once the Flutter app starts.androidx.lifecycle.LifecyclevoidonActivityResult(int requestCode, int resultCode, Intent data) A result has been returned after an invocation ofFragment.startActivityForResult(Intent, int).voidvoidThe hardware back button was pressed.voidonCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) voidvoidonDetach()voidonFlutterSurfaceViewCreated(FlutterSurfaceView flutterSurfaceView) voidonFlutterTextureViewCreated(FlutterTextureView flutterTextureView) voidInvoked after theFlutterViewwithin thisFlutterFragmentstarts rendering pixels to the screen.voidInvoked after theFlutterViewwithin thisFlutterFragmentstops rendering pixels to the screen.voidonNewIntent(Intent intent) A new Intent was received by theActivitythat currently owns thisFragment.voidonPause()voidvoidonRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) The result of a permission request has been received.voidonResume()voidonSaveInstanceState(Bundle outState) voidonStart()voidonStop()voidonTrimMemory(int level) Callback invoked when memory is low.voidTheActivitythat owns thisFragmentis 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.voidonViewCreated(View view, Bundle savedInstanceState) booleanAllow implementer to customize the behavior needed when the Flutter framework calls to pop the Android-side navigation stack.provideFlutterEngine(Context context) Hook for subclasses to return aFlutterEnginewith whatever configuration is desired.providePlatformPlugin(Activity activity, FlutterEngine flutterEngine) io.flutter.plugin.view.SensitiveContentPluginprovideSensitiveContentPlugin(Activity activity, FlutterEngine flutterEngine) voidsetFrameworkHandlesBack(boolean frameworkHandlesBack) The Flutter application would or would not like to handle navigation pop events itself.booleanbooleanReturns false if theFlutterEnginewithin thisFlutterFragmentshould outlive theFlutterFragment, itself.booleanGive the host application a chance to take control of the app lifecycle events.booleanWhether to handle the deeplinking from theIntentautomatically if thegetInitialRoutereturns null.booleanvoidwithCachedEngine(String engineId) Returns aFlutterFragment.CachedEngineFragmentBuilderto create aFlutterFragmentwith a cachedFlutterEngineinFlutterEngineCache.Returns aFlutterFragment.NewEngineFragmentBuilderto create aFlutterFragmentwith a newFlutterEngineand a desired engine configuration.withNewEngineInGroup(String engineGroupId) Returns aFlutterFragment.NewEngineInGroupFragmentBuilderto create aFlutterFragmentwith a cachedFlutterEngineGroupinFlutterEngineGroupCache.Methods inherited from class androidx.fragment.app.Fragment
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getDefaultViewModelCreationExtras, getDefaultViewModelProviderFactory, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getParentFragmentManager, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityCreated, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onViewStateRestored, postponeEnterTransition, postponeEnterTransition, registerForActivityResult, registerForActivityResult, registerForContextMenu, requestPermissions, requireActivity, requireArguments, requireContext, requireFragmentManager, requireHost, requireParentFragment, requireView, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenuMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface android.content.ComponentCallbacks
onConfigurationChanged, onLowMemory
-
Field Details
-
FLUTTER_VIEW_ID
public static final int FLUTTER_VIEW_IDThe ID of theFlutterViewcreated by this activity.This ID can be used to lookup
FlutterViewin the Android view hierarchy. For more, seeView.findViewById(int). -
ARG_DART_ENTRYPOINT
The Dart entrypoint method name that is executed upon initialization.- See Also:
-
ARG_DART_ENTRYPOINT_URI
The Dart entrypoint method's URI that is executed upon initialization.- See Also:
-
ARG_DART_ENTRYPOINT_ARGS
The Dart entrypoint arguments that is executed upon initialization.- See Also:
-
ARG_INITIAL_ROUTE
Initial Flutter route that is rendered in a Navigator widget.- See Also:
-
ARG_HANDLE_DEEPLINKING
Whether the activity delegate should handle the deeplinking request.- See Also:
-
ARG_APP_BUNDLE_PATH
Path to Flutter's Dart code.- See Also:
-
ARG_SHOULD_DELAY_FIRST_ANDROID_VIEW_DRAW
Whether to delay the Android drawing pass till after the Flutter UI has been displayed.- See Also:
-
ARG_FLUTTER_INITIALIZATION_ARGS
Flutter shell arguments.- See Also:
-
ARG_FLUTTERVIEW_RENDER_MODE
- See Also:
-
ARG_FLUTTERVIEW_TRANSPARENCY_MODE
- See Also:
-
ARG_SHOULD_ATTACH_ENGINE_TO_ACTIVITY
- See Also:
-
ARG_CACHED_ENGINE_ID
The ID of aFlutterEnginecached inFlutterEngineCachethat will be used within the createdFlutterFragment.- See Also:
-
ARG_CACHED_ENGINE_GROUP_ID
- See Also:
-
ARG_DESTROY_ENGINE_WITH_FRAGMENT
True if theFlutterEnginein the createdFlutterFragmentshould be destroyed when theFlutterFragmentis destroyed, false if theFlutterEngineshould outlive theFlutterFragment.- See Also:
-
ARG_ENABLE_STATE_RESTORATION
True if the framework state in the engine attached to this engine should be stored and restored when this fragment is created and destroyed.- See Also:
-
ARG_SHOULD_AUTOMATICALLY_HANDLE_ON_BACK_PRESSED
True if the fragment should receiveonBackPressed()events automatically, without requiring an explicit activity call through.- See Also:
-
-
Constructor Details
-
FlutterFragment
public FlutterFragment()
-
-
Method Details
-
createDefault
Creates aFlutterFragmentwith a default configuration.FlutterFragment's default configuration creates a newFlutterEnginewithin theFlutterFragmentand uses the following settings:- Dart entrypoint: "main"
- Initial route: "/"
- Render mode: surface
- Transparency mode: transparent
To use a new
FlutterEnginewith different settings, usewithNewEngine().To use a cached
FlutterEngineinstead of creating a new one, usewithCachedEngine(String). -
withNewEngine
Returns aFlutterFragment.NewEngineFragmentBuilderto create aFlutterFragmentwith a newFlutterEngineand a desired engine configuration. -
withCachedEngine
@NonNull public static FlutterFragment.CachedEngineFragmentBuilder withCachedEngine(@NonNull String engineId) Returns aFlutterFragment.CachedEngineFragmentBuilderto create aFlutterFragmentwith a cachedFlutterEngineinFlutterEngineCache.An
IllegalStateExceptionwill be thrown during the lifecycle of theFlutterFragmentif a cachedFlutterEngineis requested but does not exist in the cache.To create a
FlutterFragmentthat uses a newFlutterEngine, usecreateDefault()orwithNewEngine(). -
withNewEngineInGroup
@NonNull public static FlutterFragment.NewEngineInGroupFragmentBuilder withNewEngineInGroup(@NonNull String engineGroupId) Returns aFlutterFragment.NewEngineInGroupFragmentBuilderto create aFlutterFragmentwith a cachedFlutterEngineGroupinFlutterEngineGroupCache.An
IllegalStateExceptionwill be thrown during the lifecycle of theFlutterFragmentif a cachedFlutterEngineGroupis requested but does not exist in theFlutterEngineGroupCache. -
createDelegate
public io.flutter.embedding.android.FlutterActivityAndFragmentDelegate createDelegate(io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.Host host) Default delegate factory that creates a simple FlutterActivityAndFragmentDelegate instance.- Specified by:
createDelegatein interfaceio.flutter.embedding.android.FlutterActivityAndFragmentDelegate.DelegateFactory
-
getExclusiveAppComponent
Returns the Android App Component exclusively attached toFlutterEngine. -
onAttach
- Overrides:
onAttachin classandroidx.fragment.app.Fragment
-
onCreate
- Overrides:
onCreatein classandroidx.fragment.app.Fragment
-
onCreateView
@Nullable @RequiresApi(24) public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) - Overrides:
onCreateViewin classandroidx.fragment.app.Fragment
-
onStart
public void onStart()- Overrides:
onStartin classandroidx.fragment.app.Fragment
-
onResume
public void onResume()- Overrides:
onResumein classandroidx.fragment.app.Fragment
-
onPostResume
public void onPostResume() -
onPause
public void onPause()- Overrides:
onPausein classandroidx.fragment.app.Fragment
-
onStop
public void onStop()- Overrides:
onStopin classandroidx.fragment.app.Fragment
-
onViewCreated
- Overrides:
onViewCreatedin classandroidx.fragment.app.Fragment
-
onDestroyView
@RequiresApi(24) public void onDestroyView()- Overrides:
onDestroyViewin classandroidx.fragment.app.Fragment
-
onSaveInstanceState
- Overrides:
onSaveInstanceStatein classandroidx.fragment.app.Fragment
-
detachFromFlutterEngine
@RequiresApi(24) public void detachFromFlutterEngine() -
onDetach
public void onDetach()- Overrides:
onDetachin classandroidx.fragment.app.Fragment
-
onRequestPermissionsResult
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) The result of a permission request has been received.See
Activity.onRequestPermissionsResult(int, String[], int[])- Overrides:
onRequestPermissionsResultin classandroidx.fragment.app.Fragment- Parameters:
requestCode- identifier passed with the initial permission requestpermissions- permissions that were requestedgrantResults- permission grants or denials
-
onNewIntent
A new Intent was received by theActivitythat currently owns thisFragment.- Parameters:
intent- new Intent
-
onBackPressed
public void onBackPressed()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. -
onActivityResult
A result has been returned after an invocation ofFragment.startActivityForResult(Intent, int).- Overrides:
onActivityResultin classandroidx.fragment.app.Fragment- Parameters:
requestCode- request code sent withFragment.startActivityForResult(Intent, int)resultCode- code representing the result of theActivitythat was launcheddata- any corresponding return data, held within anIntent
-
onUserLeaveHint
public void onUserLeaveHint()TheActivitythat owns thisFragmentis 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. -
onTrimMemory
public void onTrimMemory(int level) Callback invoked when memory is low.This implementation forwards a memory pressure warning to the running Flutter app.
- Specified by:
onTrimMemoryin interfaceComponentCallbacks2- Parameters:
level- level
-
getFlutterShellArgs
FlutterActivityAndFragmentDelegate.Hostmethod that is used byFlutterActivityAndFragmentDelegateto obtain Flutter shell arguments when initializing Flutter. -
getCachedEngineId
Returns the ID of a statically cachedFlutterEngineto use within thisFlutterFragment, ornullif thisFlutterFragmentdoes not want to use a cachedFlutterEngine. -
getCachedEngineGroupId
Returns the ID of a statically cachedFlutterEngineGroupto use within thisFlutterFragment, ornullif thisFlutterFragmentdoes not want to use a cachedFlutterEngineGroup. -
shouldDestroyEngineWithHost
public boolean shouldDestroyEngineWithHost()Returns false if theFlutterEnginewithin thisFlutterFragmentshould outlive theFlutterFragment, itself.Defaults to true if no custom
is provided, false if a customFlutterEngineis provided. -
getDartEntrypointFunctionName
Returns the name of the Dart method that thisFlutterFragmentshould execute to start a Flutter app.Defaults to "main".
Used by this
FlutterFragment'sFlutterActivityAndFragmentDelegate.Host -
getDartEntrypointArgs
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.
-
getDartEntrypointLibraryUri
Returns the library URI of the Dart method that thisFlutterFragmentshould execute to start a Flutter app.Defaults to null (example value: "package:foo/bar.dart").
Used by this
FlutterFragment'sFlutterActivityAndFragmentDelegate.Host -
getAppBundlePath
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
FlutterLoader.findAppBundlePath().Used by this
FlutterFragment'sFlutterActivityAndFragmentDelegate.Host -
getInitialRoute
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'sFlutterActivityAndFragmentDelegate.Host -
getRenderMode
Returns the desiredRenderModefor theFlutterViewdisplayed in thisFlutterFragment.Defaults to
RenderMode.surface.Used by this
FlutterFragment'sFlutterActivityAndFragmentDelegate.Host -
getTransparencyMode
Returns the desiredTransparencyModefor theFlutterViewdisplayed in thisFlutterFragment.Defaults to
TransparencyMode.transparent.Used by this
FlutterFragment'sFlutterActivityAndFragmentDelegate.Host -
provideFlutterEngine
Hook for subclasses to return aFlutterEnginewith whatever configuration is desired.By default this method defers to this
FlutterFragment's surroundingActivity, if thatActivityimplementsFlutterEngineProvider. If this method is overridden, the surroundingActivitywill no longer be given an opportunity to provide aFlutterEngine, unless the subclass explicitly implements that behavior.Consider returning a cached
FlutterEngineinstance from this method to avoid the typical warm-up time that a newFlutterEngineinstance requires.If null is returned then a new default
FlutterEnginewill be created to back thisFlutterFragment.Used by this
FlutterFragment'sFlutterActivityAndFragmentDelegate.Host- Specified by:
provideFlutterEnginein interfaceFlutterEngineProvider- Parameters:
context- The current context. e.g. An activity.- Returns:
- The Flutter engine.
-
getFlutterEngine
Hook for subclasses to obtain a reference to theFlutterEnginethat is owned by thisFlutterActivity. -
providePlatformPlugin
@Nullable public PlatformPlugin providePlatformPlugin(@Nullable Activity activity, @NonNull FlutterEngine flutterEngine) -
provideSensitiveContentPlugin
@Nullable public io.flutter.plugin.view.SensitiveContentPlugin provideSensitiveContentPlugin(@Nullable Activity activity, @NonNull FlutterEngine flutterEngine) -
configureFlutterEngine
Configures aFlutterEngineafter its creation.This method is called after
provideFlutterEngine(Context), and after the givenFlutterEnginehas been attached to the owningFragmentActivity. SeeActivityControlSurface.attachToActivity(ExclusiveAppComponent, Lifecycle).It is possible that the owning
FragmentActivityopted not to connect itself as anActivityControlSurface. In that case, any configuration, e.g., plugins, must not expect or depend upon an availableActivityat the time that this method is invoked.The default behavior of this method is to defer to the owning
FragmentActivityas aFlutterEngineConfigurator. Subclasses can override this method if the subclass needs to override theFragmentActivity's behavior, or add to it.Used by this
FlutterFragment'sFlutterActivityAndFragmentDelegate.Host- Specified by:
configureFlutterEnginein interfaceFlutterEngineConfigurator- Parameters:
flutterEngine- The Flutter engine.
-
cleanUpFlutterEngine
Hook for the host to cleanup references that were established inconfigureFlutterEngine(FlutterEngine)before the host is destroyed or detached.This method is called in
onDetach().- Specified by:
cleanUpFlutterEnginein interfaceFlutterEngineConfigurator- Parameters:
flutterEngine- The Flutter engine.
-
shouldAttachEngineToActivity
public boolean shouldAttachEngineToActivity()SeeshouldAttachEngineToActivity()andshouldAttachEngineToActivity().Used by this
FlutterFragment'sFlutterActivityAndFragmentDelegate -
shouldHandleDeeplinking
public boolean shouldHandleDeeplinking()Whether to handle the deeplinking from theIntentautomatically if thegetInitialRoutereturns null. -
onFlutterSurfaceViewCreated
-
onFlutterTextureViewCreated
-
onFlutterUiDisplayed
public void onFlutterUiDisplayed()Invoked after theFlutterViewwithin thisFlutterFragmentstarts rendering pixels to the screen.This method forwards
onFlutterUiDisplayed()to its attachedActivity, if the attachedActivityimplementsFlutterUiDisplayListener.Subclasses that override this method must call through to the
supermethod.Used by this
FlutterFragment'sFlutterActivityAndFragmentDelegate.Host -
onFlutterUiNoLongerDisplayed
public void onFlutterUiNoLongerDisplayed()Invoked after theFlutterViewwithin thisFlutterFragmentstops rendering pixels to the screen.This method forwards
onFlutterUiNoLongerDisplayed()to its attachedActivity, if the attachedActivityimplementsFlutterUiDisplayListener.Subclasses that override this method must call through to the
supermethod.Used by this
FlutterFragment'sFlutterActivityAndFragmentDelegate.Host -
shouldRestoreAndSaveState
public boolean shouldRestoreAndSaveState() -
updateSystemUiOverlays
public void updateSystemUiOverlays() -
shouldDispatchAppLifecycleState
public boolean shouldDispatchAppLifecycleState()Give the host application a chance to take control of the app lifecycle events.Return
falsemeans the host application dispatches these app lifecycle events, while returntruemeans the engine dispatches these events.Defaults to
true. -
attachToEngineAutomatically
public boolean attachToEngineAutomatically()Whether to automatically attach theFlutterViewto the engine.Returning
falsemeans that the task of attaching theFlutterViewto the engine will be taken over by the host application.Defaults to
true. -
getBackCallbackState
public boolean getBackCallbackState() -
setFrameworkHandlesBack
public void setFrameworkHandlesBack(boolean frameworkHandlesBack) Description copied from interface:PlatformPlugin.PlatformPluginDelegateThe 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
FlutterActivity.- Specified by:
setFrameworkHandlesBackin interfacePlatformPlugin.PlatformPluginDelegate
-
getContext
-
getActivity
-
getLifecycle
@NonNull androidx.lifecycle.Lifecycle getLifecycle()
-