Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
io.flutter.embedding.android.FlutterActivity.NewEngineIntentBuilder Class Reference

Public Member Functions

 NewEngineIntentBuilder (@NonNull Class<? extends FlutterActivity > activityClass)
 
NewEngineIntentBuilder initialRoute (@NonNull String initialRoute)
 
NewEngineIntentBuilder backgroundMode (@NonNull BackgroundMode backgroundMode)
 
NewEngineIntentBuilder dartEntrypointArgs (@Nullable List< String > dartEntrypointArgs)
 
Intent build (@NonNull Context context)
 

Detailed Description

Builder to create an Intent that launches a FlutterActivity with a new FlutterEngine and the desired configuration.

Definition at line 258 of file FlutterActivity.java.

Constructor & Destructor Documentation

◆ NewEngineIntentBuilder()

io.flutter.embedding.android.FlutterActivity.NewEngineIntentBuilder.NewEngineIntentBuilder ( @NonNull Class<? extends FlutterActivity activityClass)
inline

Constructor that allows this NewEngineIntentBuilder to be used by subclasses of FlutterActivity.

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

return new NewEngineIntentBuilder(MyFlutterActivity.class);

Definition at line 274 of file FlutterActivity.java.

274 {
275 this.activityClass = activityClass;
276 }

Member Function Documentation

◆ backgroundMode()

NewEngineIntentBuilder io.flutter.embedding.android.FlutterActivity.NewEngineIntentBuilder.backgroundMode ( @NonNull BackgroundMode  backgroundMode)
inline

The mode of FlutterActivity's background, either BackgroundMode#opaque or BackgroundMode#transparent.

The default background mode is BackgroundMode#opaque.

Choosing a background mode of 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 BackgroundMode#transparent must have a theme applied to it that includes the following property: <item name="android:windowIsTranslucent">true</item>.

Parameters
backgroundModeThe background mode.
Returns
The engine intent builder.

Definition at line 311 of file FlutterActivity.java.

311 {
312 this.backgroundMode = backgroundMode.name();
313 return this;
314 }

◆ build()

Intent io.flutter.embedding.android.FlutterActivity.NewEngineIntentBuilder.build ( @NonNull Context  context)
inline

Creates and returns an Intent that will launch a FlutterActivity with the desired configuration.

Parameters
contextThe context. e.g. An Activity.
Returns
The intent.

Definition at line 339 of file FlutterActivity.java.

339 {
340 Intent intent =
341 new Intent(context, activityClass)
342 .putExtra(EXTRA_INITIAL_ROUTE, initialRoute)
343 .putExtra(EXTRA_BACKGROUND_MODE, backgroundMode)
344 .putExtra(EXTRA_DESTROY_ENGINE_WITH_ACTIVITY, true);
345 if (dartEntrypointArgs != null) {
346 intent.putExtra(EXTRA_DART_ENTRYPOINT_ARGS, new ArrayList(dartEntrypointArgs));
347 }
348 return intent;
349 }

◆ dartEntrypointArgs()

NewEngineIntentBuilder io.flutter.embedding.android.FlutterActivity.NewEngineIntentBuilder.dartEntrypointArgs ( @Nullable List< String >  dartEntrypointArgs)
inline

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
dartEntrypointArgsThe Dart entrypoint arguments.
Returns
The engine intent builder.

Definition at line 326 of file FlutterActivity.java.

326 {
327 this.dartEntrypointArgs = dartEntrypointArgs;
328 return this;
329 }

◆ initialRoute()

NewEngineIntentBuilder io.flutter.embedding.android.FlutterActivity.NewEngineIntentBuilder.initialRoute ( @NonNull String  initialRoute)
inline

The initial route that a Flutter app will render in this FlutterActivity, defaults to "/".

Parameters
initialRouteThe route.
Returns
The engine intent builder.

Definition at line 286 of file FlutterActivity.java.

286 {
287 this.initialRoute = initialRoute;
288 return this;
289 }

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