Flutter Engine
The Flutter Engine
|
Classes | |
class | CachedEngineIntentBuilder |
class | NewEngineInGroupIntentBuilder |
class | NewEngineIntentBuilder |
Public Member Functions | |
void | onPostResume () |
void | onRequestPermissionsResult (int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) |
void | onUserLeaveHint () |
void | onTrimMemory (int level) |
boolean | shouldDestroyEngineWithHost () |
FlutterEngine | provideFlutterEngine (@NonNull Context context) |
void | configureFlutterEngine (@NonNull FlutterEngine flutterEngine) |
void | cleanUpFlutterEngine (@NonNull FlutterEngine flutterEngine) |
String | getDartEntrypointFunctionName () |
List< String > | getDartEntrypointArgs () |
String | getDartEntrypointLibraryUri () |
FlutterEngine | provideFlutterEngine (@NonNull Context context) |
void | configureFlutterEngine (@NonNull FlutterEngine flutterEngine) |
void | cleanUpFlutterEngine (@NonNull FlutterEngine flutterEngine) |
Static Public Member Functions | |
static Intent | createDefaultIntent (@NonNull Context launchContext) |
static NewEngineIntentBuilder | withNewEngine () |
static CachedEngineIntentBuilder | withCachedEngine (@NonNull String cachedEngineId) |
static NewEngineInGroupIntentBuilder | withNewEngineInGroup (@NonNull String engineGroupId) |
Static Public Attributes | |
static final int | FRAGMENT_CONTAINER_ID = View.generateViewId() |
Protected Member Functions | |
void | onCreate (@Nullable Bundle savedInstanceState) |
FlutterFragment | createFlutterFragment () |
void | onNewIntent (@NonNull Intent intent) |
void | onActivityResult (int requestCode, int resultCode, Intent data) |
FlutterEngine | getFlutterEngine () |
boolean | shouldAttachEngineToActivity () |
boolean | shouldHandleDeeplinking () |
String | getAppBundlePath () |
Bundle | getMetaData () throws PackageManager.NameNotFoundException |
String | getInitialRoute () |
String | getCachedEngineId () |
String | getCachedEngineGroupId () |
BackgroundMode | getBackgroundMode () |
RenderMode | getRenderMode () |
FrameLayout | provideRootLayout (Context context) |
Package Functions | |
FlutterFragment | retrieveExistingFlutterFragmentIfPossible () |
A Flutter Activity
that is based upon FragmentActivity
.
FlutterFragmentActivity
exists because there are some Android APIs in the ecosystem that only accept a FragmentActivity
. If a FragmentActivity
is not required, you should consider using a regular FlutterActivity
instead, because FlutterActivity
is considered to be the standard, canonical implementation of a Flutter Activity
.
Definition at line 61 of file FlutterFragmentActivity.java.
|
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 onDestroy()
.
Implements io.flutter.embedding.android.FlutterEngineConfigurator.
Definition at line 745 of file FlutterFragmentActivity.java.
|
inline |
Hook for subclasses to easily configure a FlutterEngine
.
This method is called after provideFlutterEngine(Context)
.
All plugins listed in the app's pubspec are registered in the base implementation of this method unless the FlutterEngine for this activity was externally created. To avoid the automatic plugin registration for implicitly created FlutterEngines, override this method without invoking super(). To keep automatic plugin registration and further configure the FlutterEngine, override this method, invoke super(), and then configure the FlutterEngine as desired.
Implements io.flutter.embedding.android.FlutterEngineConfigurator.
Definition at line 727 of file FlutterFragmentActivity.java.
|
inlinestatic |
Creates an Intent
that launches a FlutterFragmentActivity
, which executes a main()
Dart entrypoint, and displays the "/" route as Flutter's initial route.
Definition at line 75 of file FlutterFragmentActivity.java.
|
inlineprotected |
Creates the instance of the FlutterFragment
that this FlutterFragmentActivity
displays.
Subclasses may override this method to return a specialization of FlutterFragment
.
Reimplemented in io.flutter.embedding.android.FlutterFragmentActivityTest.FlutterFragmentActivityWithProvidedEngine.
Definition at line 513 of file FlutterFragmentActivity.java.
|
inlineprotected |
A custom path to the bundle that contains this Flutter app's resources, e.g., Dart code snapshots.
When this FlutterFragmentActivity
is run by Flutter tooling and a data String is included in the launching Intent
, that data String is interpreted as an app bundle path.
When otherwise unspecified, the value is null, which defaults to the app bundle path defined in io.flutter.embedding.engine.loader.FlutterLoader#findAppBundlePath()
.
Subclasses may override this method to return a custom app bundle path.
Definition at line 763 of file FlutterFragmentActivity.java.
|
inlineprotected |
The desired window background mode of this Activity
, which defaults to BackgroundMode#opaque
.
Definition at line 905 of file FlutterFragmentActivity.java.
|
inlineprotected |
Definition at line 896 of file FlutterFragmentActivity.java.
|
inlineprotected |
Returns the ID of a statically cached io.flutter.embedding.engine.FlutterEngine
to use within this FlutterFragmentActivity
, or null
if this
does not want to use a cached
FlutterFragmentActivityio.flutter.embedding.engine.FlutterEngine
.
Definition at line 891 of file FlutterFragmentActivity.java.
|
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.
Definition at line 815 of file FlutterFragmentActivity.java.
|
inline |
The Dart entrypoint that will be executed as soon as the Dart snapshot is loaded.
This preference can be controlled by setting a <meta-data>
called FlutterActivityLaunchConfigs#DART_ENTRYPOINT_META_DATA_KEY
within the Android manifest definition for this FlutterFragmentActivity
.
Subclasses may override this method to directly control the Dart entrypoint.
Definition at line 796 of file FlutterFragmentActivity.java.
|
inline |
The Dart library URI for the entrypoint that will be executed as soon as the Dart snapshot is loaded.
Example value: "package:foo/bar.dart"
This preference can be controlled by setting a <meta-data>
called FlutterActivityLaunchConfigs#DART_ENTRYPOINT_URI_META_DATA_KEY
within the Android manifest definition for this FlutterFragmentActivity
.
A value of null means use the default root library.
Subclasses may override this method to directly control the Dart entrypoint uri.
Definition at line 834 of file FlutterFragmentActivity.java.
|
inlineprotected |
Definition at line 650 of file FlutterFragmentActivity.java.
|
inlineprotected |
The initial route that a Flutter app will render upon loading and executing its Dart code.
This preference can be controlled with 2 methods:
FlutterActivityLaunchConfigs#EXTRA_INITIAL_ROUTE
with the launching Intent
, or <meta-data>
called FlutterActivityLaunchConfigs#INITIAL_ROUTE_META_DATA_KEY
for this Activity
in the Android manifest. If both preferences are set, the Intent
preference takes priority.
The reason that a <meta-data>
preference is supported is because this
might be the very first
ActivityActivity
launched, which means the developer won't have control over the incoming Intent
.
Subclasses may override this method to directly control the initial route.
If this method returns null and the shouldHandleDeeplinking
returns true, the initial route is derived from the Intent
through the Intent.getData() instead.
Definition at line 869 of file FlutterFragmentActivity.java.
|
inlineprotected |
Retrieves the meta data specified in the AndroidManifest.xml.
Definition at line 780 of file FlutterFragmentActivity.java.
|
inlineprotected |
Returns the desired RenderMode
for the FlutterView
displayed in this
.
FlutterFragmentActivity
That is, RenderMode#surface
if FlutterFragmentActivity#getBackgroundMode()
is BackgroundMode#opaque
or RenderMode#texture
otherwise.
Definition at line 921 of file FlutterFragmentActivity.java.
|
inlineprotected |
Definition at line 643 of file FlutterFragmentActivity.java.
|
inlineprotected |
Definition at line 373 of file FlutterFragmentActivity.java.
|
inlineprotected |
Definition at line 617 of file FlutterFragmentActivity.java.
|
inline |
Definition at line 611 of file FlutterFragmentActivity.java.
|
inline |
Definition at line 624 of file FlutterFragmentActivity.java.
|
inline |
Definition at line 637 of file FlutterFragmentActivity.java.
|
inline |
Definition at line 632 of file FlutterFragmentActivity.java.
|
inline |
Hook for subclasses to easily provide a custom FlutterEngine
.
Implements io.flutter.embedding.android.FlutterEngineProvider.
Reimplemented in io.flutter.embedding.android.FlutterFragmentActivityTest.FlutterFragmentActivityWithProvidedEngine.
Definition at line 709 of file FlutterFragmentActivity.java.
|
inlineprotected |
Returns a FrameLayout
that is used as the content view of this activity.
Definition at line 937 of file FlutterFragmentActivity.java.
|
inlinepackage |
Retrieves the previously created FlutterFragment
if possible.
If the activity is recreated, an existing FlutterFragment
may already exist. Retain a reference to that FlutterFragment
in the #flutterFragment
field and avoid re-creating another FlutterFragment
.
Definition at line 476 of file FlutterFragmentActivity.java.
|
inlineprotected |
Hook for subclasses to control whether or not the FlutterFragment
within this
automatically attaches its
Activityio.flutter.embedding.engine.FlutterEngine
to this Activity
.
For an explanation of why this control exists, see FlutterFragment.NewEngineFragmentBuilder#shouldAttachEngineToActivity()
.
This property is controlled with a protected method instead of an Intent
argument because the only situation where changing this value would help, is a situation in which
is being subclassed to utilize a custom and/or cached
FlutterFragmentActivityFlutterEngine
.
Defaults to true
.
Definition at line 682 of file FlutterFragmentActivity.java.
|
inline |
Returns false if the io.flutter.embedding.engine.FlutterEngine
backing this
should outlive this
FlutterFragmentActivityFlutterFragmentActivity
, or true to be destroyed when the FlutterFragmentActivity
is destroyed.
The default value is true
in cases where FlutterFragmentActivity
created its own io.flutter.embedding.engine.FlutterEngine
, and false
in cases where a cached io.flutter.embedding.engine.FlutterEngine
was provided.
Definition at line 663 of file FlutterFragmentActivity.java.
|
inlineprotected |
Whether to handle the deeplinking from the Intent
automatically if the
returns null.
getInitialRoute
The default implementation looks <meta-data>
called FlutterActivityLaunchConfigs#HANDLE_DEEPLINKING_META_DATA_KEY
within the Android manifest definition for this FlutterFragmentActivity
.
Definition at line 695 of file FlutterFragmentActivity.java.
|
inlinestatic |
Creates a CachedEngineIntentBuilder
, which can be used to configure an Intent
to launch a FlutterFragmentActivity
that internally uses an existing FlutterEngine
that is cached in io.flutter.embedding.engine.FlutterEngineCache
.
Definition at line 186 of file FlutterFragmentActivity.java.
|
inlinestatic |
Creates an FlutterFragmentActivity.NewEngineIntentBuilder
, which can be used to configure an Intent
to launch a FlutterFragmentActivity
that internally creates a new io.flutter.embedding.engine.FlutterEngine
using the desired Dart entrypoint, initial route, etc.
Definition at line 86 of file FlutterFragmentActivity.java.
|
inlinestatic |
Creates a NewEngineInGroupIntentBuilder
, which can be used to configure an Intent
to launch a FlutterFragmentActivity
that internally uses an existing io.flutter.embedding.engine.FlutterEngineGroup
that is cached in io.flutter.embedding.engine.FlutterEngineGroupCache
.
engineGroupId | A cached engine group ID. |
Definition at line 273 of file FlutterFragmentActivity.java.
|
static |
Definition at line 68 of file FlutterFragmentActivity.java.