with calls to:

void

attachToActivity

@NonNull

ExclusiveAppComponent

Activity

exclusiveActivity

@NonNull

Lifecycle

lifecycle

);

on the ActivityControlSurface that you obtained by calling
getActivityControlSurface() on the FlutterEngine.

Wrap your activity with an ExclusiveAppComponent<Activity>
and implement the callback method:

void

detachFromFlutterEngine

();

to handle your activity being replaced by another
activity being attached to the FlutterEngine.
Generally, you want to perform the same detaching operations
as performed when the activity is being naturally destroyed.

Timeline

Landed in version: 1.23.0-7.0.pre
In stable release: 2.0.0

References