Package io.flutter.embedding.engine.loader

## Class FlutterLoader

- java.lang.Object
- - io.flutter.embedding.engine.loader.FlutterLoader

-     public class FlutterLoader
      extends Object

  Finds Flutter resources in an application APK and also loads Flutter's native library.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `FlutterLoader.Settings` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `FlutterLoader()` | Creates a `FlutterLoader` that uses a default constructed `FlutterJNI` and `ExecutorService`.
    `FlutterLoader​(FlutterJNI flutterJNI)` | Creates a `FlutterLoader` that uses a default constructed `ExecutorService`.
    `FlutterLoader​(FlutterJNI flutterJNI, ExecutorService executorService)` | Creates a `FlutterLoader` with the specified `FlutterJNI`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `automaticallyRegisterPlugins()` | Returns the configuration on whether flutter engine should automatically register plugins.
    `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()` |
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FlutterLoader

          public FlutterLoader()

      Creates a `FlutterLoader` that uses a default constructed `FlutterJNI` and `ExecutorService`.

    - #### FlutterLoader

          public FlutterLoader​(@NonNull
                               FlutterJNI flutterJNI)

      Creates a `FlutterLoader` that uses a default constructed `ExecutorService`.
      Parameters:
        `flutterJNI` - The `FlutterJNI` instance to use for loading the libflutter.so C++ library, setting up the font manager, and calling into C++ initialization.

    - #### FlutterLoader

          public FlutterLoader​(@NonNull
                               FlutterJNI flutterJNI,
                               @NonNull
                               ExecutorService executorService)

      Creates a `FlutterLoader` with the specified `FlutterJNI`.
      Parameters:
        `flutterJNI` - The `FlutterJNI` instance to use for loading the libflutter.so C++ library, setting up the font manager, and calling into C++ initialization.
        `executorService` - The `ExecutorService` to use when creating new threads.

  - ### Method Detail

    - #### startInitialization

          public void startInitialization​(@NonNull
                                          Context applicationContext)

      Starts initialization of the native system.
      Parameters:
        `applicationContext` - The Android application context.

    - #### startInitialization

          public void startInitialization​(@NonNull
                                          Context applicationContext,
                                          @NonNull
                                          FlutterLoader.Settings settings)

      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:
        `applicationContext` - The Android application context.
        `settings` - Configuration settings.

    - #### ensureInitializationComplete

          public void ensureInitializationComplete​(@NonNull
                                                   Context applicationContext,
                                                   @Nullable
                                                   String[] args)

      Blocks until initialization of the native system has completed.

      Calling this method multiple times has no effect.

      Parameters:
        `applicationContext` - The Android application context.
        `args` - Flags sent to the Flutter runtime.

    - #### ensureInitializationCompleteAsync

          public void ensureInitializationCompleteAsync​(@NonNull
                                                        Context applicationContext,
                                                        @Nullable
                                                        String[] args,
                                                        @NonNull
                                                        Handler callbackHandler,
                                                        @NonNull
                                                        Runnable callback)

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

    - #### initialized

          public boolean initialized()

      Returns whether the FlutterLoader has finished loading the native library.

    - #### findAppBundlePath

          @NonNull
          public String findAppBundlePath()

    - #### getLookupKeyForAsset

          @NonNull
          public String getLookupKeyForAsset​(@NonNull
                                             String asset)

      Returns the file name for the given asset. The returned file name can be used to access the asset in the APK through the `AssetManager` API.
      Parameters:
        `asset` - the name of the asset. The name can be hierarchical
      Returns:
        the filename to be used with `AssetManager`

    - #### getLookupKeyForAsset

          @NonNull
          public String getLookupKeyForAsset​(@NonNull
                                             String asset,
                                             @NonNull
                                             String packageName)

      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 `AssetManager` API.
      Parameters:
        `asset` - the name of the asset. The name can be hierarchical
        `packageName` - the name of the package from which the asset originates
      Returns:
        the file name to be used with `AssetManager`

    - #### automaticallyRegisterPlugins

          @NonNull
          public boolean automaticallyRegisterPlugins()

      Returns the configuration on whether flutter engine should automatically register plugins.