Skip to content
Boring Doc
BreakingHigh impactOfficial migration guidesince 3.35.0landed 3.34.0-pre

The Visibility widget is no longer focusable by default when maintainState is enabled

Framework · Official source

This change was introduced to fix an issue where an `IndexedStack`s hidden children would be focusable with keyboard events (see issue) due to the underlying `Visibility` widgets default behavior.

Original behavior

Not stated in the source.

New behavior

The core change is the `Visibility` widget is no longer focusable by default when `maintainState` is enabled. A new flag, `maintainFocusability`, must be set to true with `maintainState` for a hidden widget to remain focusable.

Who is affected
Applications and packages relying on the previous behaviour or signature. Code that uses IndexedStack, Visibility.
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.
APIs mentioned:IndexedStackVisibility

Before and after (from the official guide)

dart+1−0
Before
1 child: Visibility(
2 maintainState: true,
 
3 child: SomeWidget(),
4 )
After
1 child: Visibility(
2 maintainState: true,
3+ maintainFocusability: true,
4 child: SomeWidget(),
5 )
Raw before / after
child: Visibility(
    maintainState: true,
    child: SomeWidget(),
)
child: Visibility(
    maintainState: true,
    maintainFocusability: true,
    child: SomeWidget(),
)
Official migration guide (excerpt, © The Flutter Authors, CC BY 3.0)

If your app has a Visibility widget that does not set maintainState to true, then no changes are required.

If your app has a Visibility widget that sets maintainState to true and you relied on the previous default behavior that allowed you to focus your hidden widget, you will need to set maintainFocusability to true.

Code before migration:

child: Visibility(
    maintainState: true,
    child: SomeWidget(),
)

Code after migration:

child: Visibility(
    maintainState: true,
    maintainFocusability: true,
    child: SomeWidget(),
)
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?