public class FlutterLoader extends Object
Modifier and Type | Class and Description |
---|---|
static class |
FlutterLoader.Settings |
Constructor and Description |
---|
FlutterLoader()
Creates a
FlutterLoader that uses a default constructed FlutterJNI . |
FlutterLoader(FlutterJNI flutterJNI)
Creates a
FlutterLoader with the specified FlutterJNI . |
Modifier and Type | Method and Description |
---|---|
void |
ensureInitializationComplete(Context applicationContext,
String[] args)
Blocks until initialization of the native system has completed.
|
void |
ensureInitializationCompleteAsync(Context applicationContext,
String[] args,
Handler callbackHandler,
Runnable callback)
Same as
ensureInitializationComplete(Context, String[]) but waiting on a background
thread, then invoking callback on the callbackHandler . |
String |
findAppBundlePath() |
static FlutterLoader |
getInstance()
Deprecated.
Use the
FlutterInjector instead. |
String |
getLookupKeyForAsset(String asset)
Returns the file name for the given asset.
|
String |
getLookupKeyForAsset(String asset,
String packageName)
Returns the file name for the given asset which originates from the specified packageName.
|
boolean |
initialized()
Returns whether the FlutterLoader has finished loading the native library.
|
void |
startInitialization(Context applicationContext)
Starts initialization of the native system.
|
void |
startInitialization(Context applicationContext,
FlutterLoader.Settings settings)
Starts initialization of the native system.
|
public FlutterLoader()
FlutterLoader
that uses a default constructed FlutterJNI
.public FlutterLoader(@NonNull FlutterJNI flutterJNI)
FlutterLoader
with the specified FlutterJNI
.flutterJNI
- The FlutterJNI
instance to use for loading the libflutter.so C++
library, setting up the font manager, and calling into C++ initalization.@Deprecated @NonNull public static FlutterLoader getInstance()
FlutterInjector
instead.FlutterLoader
instance.
The returned instance loads Flutter native libraries in the standard way. A singleton object is used instead of static methods to facilitate testing without actually running native library linking.
public void startInitialization(@NonNull Context applicationContext)
applicationContext
- The Android application context.public void startInitialization(@NonNull Context applicationContext, @NonNull FlutterLoader.Settings settings)
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.
applicationContext
- The Android application context.settings
- Configuration settings.public void ensureInitializationComplete(@NonNull Context applicationContext, @Nullable String[] args)
Calling this method multiple times has no effect.
applicationContext
- The Android application context.args
- Flags sent to the Flutter runtime.public void ensureInitializationCompleteAsync(@NonNull Context applicationContext, @Nullable String[] args, @NonNull Handler callbackHandler, @NonNull Runnable callback)
ensureInitializationComplete(Context, String[])
but waiting on a background
thread, then invoking callback
on the callbackHandler
.public boolean initialized()
@NonNull public String findAppBundlePath()
@NonNull public String getLookupKeyForAsset(@NonNull String asset)
AssetManager
API.asset
- the name of the asset. The name can be hierarchicalAssetManager
@NonNull public String getLookupKeyForAsset(@NonNull String asset, @NonNull String packageName)
AssetManager
API.asset
- the name of the asset. The name can be hierarchicalpackageName
- the name of the package from which the asset originatesAssetManager