Skip to content
Boring Doc
BreakingHigh impactOfficial migration guidesince 2.0.0landed 1.23.0-7.0.preandroid

Android ActivityControlSurface attachToActivity signature change

Framework · Official source

`FlutterActivity` or `FlutterFragment`, and don't manually embed a `FlutterView` inside your own custom `Activity` (this should be uncommon), you can stop reading.

Original behavior

In order for custom Activities to also supply the `Activity` lifecycle events Flutter plugins expect using the `ActivityAware` interface, the `FlutterEngine` exposed a `getActivityControlSurface()` API.

New behavior

After Issue #21272, instead of attaching your activity to the `FlutterEngine` by using the:

Who is affected
Applications and packages relying on the previous behaviour or signature. Code that uses FlutterActivity, FlutterFragment, FlutterView and related APIs.
Practical impact
Behaviour or API differences that can break builds or change runtime behaviour.
What action should I take?
Follow the official migration guide below, update affected call sites, run `dart fix --apply` where a fix is available, then run your tests.
Official migration guide (excerpt, © The Flutter Authors, CC BY 3.0)

If you have your own activity holding a [FlutterView][], replace calls to:

void attachToActivity(@NonNull Activity activity, @NonNull Lifecycle lifecycle);

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.

Migration assistantAI-generated · grounded in cited sources
AI explanations are not configured
Set AI_PROVIDER (for example to openai-compatible with a local Ollama or LM Studio endpoint) to enable grounded explanations. Everything else on this page works without an AI provider.
Official migration guide·Verified classification (95%)

Listed in the official breaking-changes index (docs.flutter.dev/release/breaking-changes).

An official announcement or migration guide documents an intended behaviour or API change. A verified source change (git diff) shows code changed but does not by itself prove a public API is breaking. AI interpretations are labelled and never used to classify a change.

Source commit
b3045439b7c0
Source last updated
Oct 21, 2026
Last synchronized
Oct 21, 2026
Publication status
published
Publication history
  • Oct 21, 2026, 8:31 PM: new → published (ingestion) — Backed by an official breaking-change/migration guide.
AI explanationAI-generated · grounded in cited sources
AI explanations are not configured
Set AI_PROVIDER (for example to openai-compatible with a local Ollama or LM Studio endpoint) to enable grounded explanations. Everything else on this page works without an AI provider.
Was this useful?