`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)
| 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 | − | ); |
| 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,
);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 --applyis 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<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<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<String>(
value: 'Option 1',
items: const [
DropdownMenuItem(value: 'Option 1', child: Text('Option 1')),
],
onChanged: condition ? (value) { ... } : null,
);Code after migration:
final conditionalDropdown = DropdownButton<String>(
value: 'Option 1',
items: const [
DropdownMenuItem(value: 'Option 1', child: Text('Option 1')),
],
- onChanged: condition ? (value) { ... } : null,
+ onChanged: (value) { ... },
+ enabled: condition,
);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.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.
- Official migration guide
- Why is DropdownButtonFormField's onChanged required?
- Update DropdownButton enabled property logic
- 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_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.