Flutter Engine
The Flutter Engine
Classes | Static Public Member Functions | List of all members
io.flutter.view.FlutterMain Class Reference

Classes

class  Settings
 

Static Public Member Functions

static void startInitialization (@NonNull Context applicationContext)
 
static void startInitialization ( @NonNull Context applicationContext, @NonNull Settings settings)
 
static void ensureInitializationComplete ( @NonNull Context applicationContext, @Nullable String[] args)
 
static void ensureInitializationCompleteAsync ( @NonNull Context applicationContext, @Nullable String[] args, @NonNull Handler callbackHandler, @NonNull Runnable callback)
 
static String findAppBundlePath ()
 
static String findAppBundlePath (@NonNull Context applicationContext)
 
static String getLookupKeyForAsset (@NonNull String asset)
 
static String getLookupKeyForAsset (@NonNull String asset, @NonNull String packageName)
 

Detailed Description

A legacy class to initialize the Flutter engine.

Deprecated:
Replaced by io.flutter.embedding.engine.loader.FlutterLoader.

Definition at line 20 of file FlutterMain.java.

Member Function Documentation

◆ ensureInitializationComplete()

static void io.flutter.view.FlutterMain.ensureInitializationComplete ( @NonNull Context  applicationContext,
@Nullable String[]  args 
)
inlinestatic

Blocks until initialization of the native system has completed.

Calling this method multiple times has no effect.

Parameters
applicationContextThe Android application context.
argsFlags sent to the Flutter runtime.

Definition at line 75 of file FlutterMain.java.

76 {
77 FlutterInjector.instance()
78 .flutterLoader()
79 .ensureInitializationComplete(applicationContext, args);
80 }
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ ensureInitializationCompleteAsync()

static void io.flutter.view.FlutterMain.ensureInitializationCompleteAsync ( @NonNull Context  applicationContext,
@Nullable String[]  args,
@NonNull Handler  callbackHandler,
@NonNull Runnable  callback 
)
inlinestatic

Same as ensureInitializationComplete(Context, String[]) but waiting on a background thread, then invoking callback on the callbackHandler.

Definition at line 86 of file FlutterMain.java.

90 {
91 FlutterInjector.instance()
92 .flutterLoader()
93 .ensureInitializationCompleteAsync(applicationContext, args, callbackHandler, callback);
94 }
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

◆ findAppBundlePath() [1/2]

static String io.flutter.view.FlutterMain.findAppBundlePath ( )
inlinestatic

Definition at line 97 of file FlutterMain.java.

97 {
98 return FlutterInjector.instance().flutterLoader().findAppBundlePath();
99 }

◆ findAppBundlePath() [2/2]

static String io.flutter.view.FlutterMain.findAppBundlePath ( @NonNull Context  applicationContext)
inlinestatic

Definition at line 103 of file FlutterMain.java.

103 {
104 return FlutterInjector.instance().flutterLoader().findAppBundlePath();
105 }

◆ getLookupKeyForAsset() [1/2]

static String io.flutter.view.FlutterMain.getLookupKeyForAsset ( @NonNull String  asset)
inlinestatic

Returns the file name for the given asset. The returned file name can be used to access the asset in the APK through the android.content.res.AssetManager API.

Parameters
assetthe name of the asset. The name can be hierarchical
Returns
the filename to be used with android.content.res.AssetManager

Definition at line 115 of file FlutterMain.java.

115 {
116 return FlutterInjector.instance().flutterLoader().getLookupKeyForAsset(asset);
117 }

◆ getLookupKeyForAsset() [2/2]

static String io.flutter.view.FlutterMain.getLookupKeyForAsset ( @NonNull String  asset,
@NonNull String  packageName 
)
inlinestatic

Returns the file name for the given asset which originates from the specified packageName. The returned file name can be used to access the asset in the APK through the android.content.res.AssetManager API.

Parameters
assetthe name of the asset. The name can be hierarchical
packageNamethe name of the package from which the asset originates
Returns
the file name to be used with android.content.res.AssetManager

Definition at line 129 of file FlutterMain.java.

129 {
130 return FlutterInjector.instance().flutterLoader().getLookupKeyForAsset(asset, packageName);
131 }

◆ startInitialization() [1/2]

static void io.flutter.view.FlutterMain.startInitialization ( @NonNull Context  applicationContext,
@NonNull Settings  settings 
)
inlinestatic

Starts initialization of the native system.

This loads the Flutter engine's native library to enable subsequent JNI calls. This also starts locating and unpacking Dart resources packaged in the app's APK.

Calling this method multiple times has no effect.

Parameters
applicationContextThe Android application context.
settingsConfiguration settings.

Definition at line 60 of file FlutterMain.java.

61 {
62 FlutterLoader.Settings newSettings = new FlutterLoader.Settings();
63 newSettings.setLogTag(settings.getLogTag());
64 FlutterInjector.instance().flutterLoader().startInitialization(applicationContext, newSettings);
65 }

◆ startInitialization() [2/2]

static void io.flutter.view.FlutterMain.startInitialization ( @NonNull Context  applicationContext)
inlinestatic

Starts initialization of the native system.

Parameters
applicationContextThe Android application context.

Definition at line 45 of file FlutterMain.java.

45 {
46 FlutterInjector.instance().flutterLoader().startInitialization(applicationContext);
47 }

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