Skip to content
Boring Doc
BreakingHigh impactOfficial migration guidenot yet in a stable releaselanded Not yet

Added enabled property and made onChanged optional for DropdownButton

Framework · Official source

`DropdownButton` and `DropdownButtonFormField` now include an `enabled` property to explicitly manage their interactive state, and the `onChanged` callback is no longer marked as `required`.

Who is affected
Applications and packages relying on the previous behaviour or signature. Code that uses DropdownButton, DropdownButtonFormField.
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.

Before and after (from the official guide)

dart+7−6
Before
1 final disabledDropdown = DropdownButton<String>(
2− value: 'Option 1',
3− items: const [
4− DropdownMenuItem(value: 'Option 1', child: Text('Option 1')),
5− ],
6− onChanged: null, // This was the only way to disable it.
7−);
 
After
1 final disabledDropdown = DropdownButton<String>(
2+ value: 'Option 1',
3+ items: const [
4+ DropdownMenuItem(value: 'Option 1', child: Text('Option 1')),
5+ ],
6+- onChanged: null, // This was the only way to disable it.
7++ enabled: false,
8+ );
Raw before / after
final disabledDropdown = DropdownButton<String>(
  value: 'Option 1',
  items: const [
    DropdownMenuItem(value: 'Option 1', child: Text('Option 1')),
  ],
  onChanged: null, // This was the only way to disable it.
);
final disabledDropdown = DropdownButton<String>(
    value: 'Option 1',
    items: const [
      DropdownMenuItem(value: 'Option 1', child: Text('Option 1')),
    ],
-   onChanged: null, // This was the only way to disable it.
+   enabled: false,
  );
Migration checklist0/2
Official migration guide (excerpt, © The Flutter Authors, CC BY 3.0)

If you previously disabled your DropdownButton by conditionally passing null to onChanged, migrate to the new enabled property. This cleanly separates the state of the widget (enabled/disabled) from its behavior (the callback).

To automatically migrate your code for simple cases (such as statically passing null), run the following command:

$ dart fix --apply

is set using conditional logic. For those, you must update your code manually.

For simple cases where a dropdown is permanently disabled, you can now simply omit onChanged and use enabled: false.

Code before migration:

final disabledDropdown = DropdownButton&#x3C;String>(
  value: 'Option 1',
  items: const [
    DropdownMenuItem(value: 'Option 1', child: Text('Option 1')),
  ],
  onChanged: null, // This was the only way to disable it.
);

Code after migration:

  final disabledDropdown = DropdownButton&#x3C;String>(
    value: 'Option 1',
    items: const [
      DropdownMenuItem(value: 'Option 1', child: Text('Option 1')),
    ],
-   onChanged: null, // This was the only way to disable it.
+   enabled: false,
  );

Case 2: Conditionally disabled dropdown {: #case-2-conditionally-disabled }

The recommended best practice is to separate the callback from the interactive state by using the enabled property directly.

Code before migration:

final conditionalDropdown = DropdownButton&#x3C;String>(
  value: 'Option 1',
  items: const [
    DropdownMenuItem(value: 'Option 1', child: Text('Option 1')),
  ],
  onChanged: condition ? (value) { ... } : null,
);

Code after migration:

  final conditionalDropdown = DropdownButton&#x3C;String>(
    value: 'Option 1',
    items: const [
      DropdownMenuItem(value: 'Option 1', child: Text('Option 1')),
    ],
-   onChanged: condition ? (value) { ... } : null,
+   onChanged: (value) { ... },
+   enabled: condition,
  );
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?