Class FlutterEngineFlags
The term "shell" refers to the native code that adapts Flutter to different platforms.
Flutter's Android Java code initializes a native "shell" and passes these arguments to that
native shell when it is initialized. See FlutterLoader.ensureInitializationComplete(Context, String[])
for more information.
All of these flags map to a flag listed in shell/common/switches.cc, which contains the full list of flags that can be set across all platforms.
These flags can either be set via the manifest metadata in a Flutter component's
AndroidManifest.xml or via the command line. See the inner Flag class for the
specification of how to set each flag via the command line and manifest metadata.
If the same flag is provided both via command line arguments and via AndroidManifest.xml metadata, the command line value will take precedence at runtime.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a Flutter shell flag that can be set via manifest metadata or command line. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final List<FlutterEngineFlags.Flag> static final FlutterEngineFlags.FlagSpecifies the path to the AOT shared library containing compiled Dart code.static final FlutterEngineFlags.FlagDeprecated.static final FlutterEngineFlags.FlagDeprecated.static final FlutterEngineFlags.FlagDisables the merging of the UI and platform threads.static final FlutterEngineFlags.FlagUse Skia software backend for rendering.static final FlutterEngineFlags.FlagSets the directory containing Flutter assets.static final FlutterEngineFlags.FlagSpecifies the path to the isolate snapshot data file.static final FlutterEngineFlags.FlagSet whether leave or clean up the VM after the last shell shuts down.static final FlutterEngineFlags.FlagSets the old generation heap size for the Dart VM in megabytes.static final FlutterEngineFlags.FlagFake flag used for integration testing of the Android embedding processing engine flags.static final FlutterEngineFlags.FlagSpecifies the path to the VM snapshot data file. -
Method Summary
Modifier and TypeMethodDescriptionstatic FlutterEngineFlags.FlagLooks up aFlutterEngineFlags.Flagby its engineArgument.static FlutterEngineFlags.FlaggetFlagFromIntentKey(String intentKey) Looks up aFlutterEngineFlags.Flagby its Intent key.static FlutterEngineFlags.FlagReturns the replacement flag of that given if it is deprecated.static booleanReturns whether or not a flag is disabled and should raise an exception if used.
-
Field Details
-
AOT_SHARED_LIBRARY_NAME
Specifies the path to the AOT shared library containing compiled Dart code.The AOT shared library that the engine uses will default to the library set by this flag, but will fall back to the libraries set internally by the embedding if the path specified by this argument is invalid.
Allowed in release to support the same AOT configuration regardless of build mode. Only settable via the manifest.
-
DEPRECATED_AOT_SHARED_LIBRARY_NAME
Deprecated.Deprecated flag that specifies the path to the AOT shared library containing compiled Dart code.Please use
AOT_SHARED_LIBRARY_NAMEinstead. -
FLUTTER_ASSETS_DIR
Sets the directory containing Flutter assets.Allowed in release to specify custom asset locations in production. Only settable via the manifest.
-
DEPRECATED_FLUTTER_ASSETS_DIR
Deprecated.The deprecated flag that sets the directory containing Flutter assets.Please use
FLUTTER_ASSETS_DIRinfstead. -
OLD_GEN_HEAP_SIZE
Sets the old generation heap size for the Dart VM in megabytes.Allowed in release for performance tuning. Only settable via the manifest.
-
VM_SNAPSHOT_DATA
Specifies the path to the VM snapshot data file.Allowed in release to support different snapshot configurations. Only settable via the manifest.
-
ISOLATE_SNAPSHOT_DATA
Specifies the path to the isolate snapshot data file.Allowed in release to support different snapshot configurations. Only settable via the manifest.
-
ENABLE_SOFTWARE_RENDERING
Use Skia software backend for rendering.Settable via the command line and the manifest.
-
TEST_FLAG
Fake flag used for integration testing of the Android embedding processing engine flags.Only settable via the manifest.
-
LEAK_VM
Set whether leave or clean up the VM after the last shell shuts down. It can be set from app's metadata in the application block in AndroidManifest.xml. Set it to true in to leave the Dart VM, set it to false to destroy VM.If your want to let your app destroy the last shell and re-create shells more quickly, set it to true, otherwise if you want to clean up the memory of the leak VM, set it to false.
Only settable via the manifest.
TODO(eggfly): Should it be set to false by default? https://github.com/flutter/flutter/issues/96843
-
DISABLE_MERGED_PLATFORM_UI_THREAD
Disables the merging of the UI and platform threads.This flag is disabled and only exists for the purpose of throwing an exception when used.
-
ALL_FLAGS
-
-
Method Details
-
getFlagByEngineArgument
Looks up aFlutterEngineFlags.Flagby its engineArgument. -
getFlagFromIntentKey
Looks up aFlutterEngineFlags.Flagby its Intent key.Previously, the Intent keys were used to set Flutter shell arguments via Intent. The Intent keys typically match the command line argument without the "--" prefix and "=" suffix if the argument takes a value.
-
isDisabled
Returns whether or not a flag is disabled and should raise an exception if used. -
getReplacementFlagIfDeprecated
Returns the replacement flag of that given if it is deprecated.
-