Package io.flutter.embedding.android

# Class FlutterActivity.NewEngineIntentBuilder

java.lang.Object
io.flutter.embedding.android.FlutterActivity.NewEngineIntentBuilder

Enclosing class:
  FlutterActivity

public static class FlutterActivity.NewEngineIntentBuilder extends Object
Builder to create an `Intent` that launches a `FlutterActivity` with a new `FlutterEngine` and the desired configuration.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NewEngineIntentBuilder(Class<? extends FlutterActivity> activityClass)`
  Constructor that allows this `NewEngineIntentBuilder` to be used by subclasses of `FlutterActivity`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `FlutterActivity.NewEngineIntentBuilder`
  `backgroundMode(FlutterActivityLaunchConfigs.BackgroundMode backgroundMode)`
  The mode of `FlutterActivity`'s background, either `FlutterActivityLaunchConfigs.BackgroundMode.opaque` or `FlutterActivityLaunchConfigs.BackgroundMode.transparent`.
  `Intent`
  `build(Context context)`
  Creates and returns an `Intent` that will launch a `FlutterActivity` with the desired configuration.
  `FlutterActivity.NewEngineIntentBuilder`
  `dartEntrypointArgs(List<String> dartEntrypointArgs)`
  The Dart entrypoint arguments will be passed as a list of string to Dart's entrypoint function.
  `FlutterActivity.NewEngineIntentBuilder`
  `initialRoute(String initialRoute)`
  The initial route that a Flutter app will render in this `FlutterActivity`, defaults to "/".

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

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

- ## Constructor Details

  - ### NewEngineIntentBuilder

    public NewEngineIntentBuilder(@NonNull Class<? extends FlutterActivity> activityClass)
    Constructor that allows this `NewEngineIntentBuilder` to be used by subclasses of `FlutterActivity`.

    Subclasses of `FlutterActivity` should provide their own static version of `FlutterActivity.withNewEngine()`, which returns an instance of `NewEngineIntentBuilder` constructed with a `Class` reference to the `FlutterActivity` subclass, e.g.:

    `return new NewEngineIntentBuilder(MyFlutterActivity.class);`

- ## Method Details

  - ### initialRoute

    @NonNull public FlutterActivity.NewEngineIntentBuilder initialRoute(@NonNull String initialRoute)
    The initial route that a Flutter app will render in this `FlutterActivity`, defaults to "/".
    Parameters:
      `initialRoute` - The route.
    Returns:
      The engine intent builder.

  - ### backgroundMode

    @NonNull public FlutterActivity.NewEngineIntentBuilder backgroundMode(@NonNull FlutterActivityLaunchConfigs.BackgroundMode backgroundMode)
    The mode of `FlutterActivity`'s background, either `FlutterActivityLaunchConfigs.BackgroundMode.opaque` or `FlutterActivityLaunchConfigs.BackgroundMode.transparent`.

    The default background mode is `FlutterActivityLaunchConfigs.BackgroundMode.opaque`.

    Choosing a background mode of `FlutterActivityLaunchConfigs.BackgroundMode.transparent` will configure the inner `FlutterView` of this `FlutterActivity` to be configured with a `FlutterTextureView` to support transparency. This choice has a non-trivial performance impact. A transparent background should only be used if it is necessary for the app design being implemented.

    A `FlutterActivity` that is configured with a background mode of `FlutterActivityLaunchConfigs.BackgroundMode.transparent` must have a theme applied to it that includes the following property: `<item name="android:windowIsTranslucent">true</item>`.

    Parameters:
      `backgroundMode` - The background mode.
    Returns:
      The engine intent builder.

  - ### dartEntrypointArgs

    @NonNull public FlutterActivity.NewEngineIntentBuilder dartEntrypointArgs(@Nullable List<String> dartEntrypointArgs)
    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.

    Parameters:
      `dartEntrypointArgs` - The Dart entrypoint arguments.
    Returns:
      The engine intent builder.

  - ### build

    @NonNull public Intent build(@NonNull Context context)
    Creates and returns an `Intent` that will launch a `FlutterActivity` with the desired configuration.
    Parameters:
      `context` - The context. e.g. An Activity.
    Returns:
      The intent.