Repository navigation
Description
Steps to Reproduce
Try to initialize a DropdownButtonFormField without specifying the onChanged parameter.
Expected results:
For onChanged to not be required and the widget to still work, which is consistent with other FormField widgets, such as TextFormField.
Actual results:
Currently the onChanged parameter is required and is seemingly used as a way to disable the widget if you set it to null. If you don't care about the onChanged event and just want to use the DropdownButtonFormField in a normal basic form, you still have to set onChanged to an empty function (e.g. onChanged: (value) {}) otherwise it won't update the FormState/stay enabled. This feels unintuitive to me since e.g. the TextFormField widget does not require you to specify onChanged unless you're interested in that event.
While I'm not that experienced with Flutter, it seems like it would make more sense to not use onChanged as a way of disabling a DropdownButtonFormField and instead let it purely be a way of letting the user do something when the field changes. I don't know if there are issues with that or if this odd current behavior is just a leftover from old logic? Seems easy enough to change it up (I could attempt to submit a PR for it).
Proposed Changes:
Add a bool enabled parameter to DropdownButtonFormField (consistent with TextFormField) and use that to decide whether to set the underlying DropdownButton.onChanged to control its enabled'ness.
In the future, it might make sense to add an enabled parameter to DropdownButton as well, as an explicit way of controlling whether it should be enabled or not.
Activity
flutter-triage-bot commentedon Jul 12, 2023
This issue is missing a priority label. Please set a priority label when adding the
triaged-designlabel.Mairramer commentedon Jan 14, 2026
@justinmc I’m looking into this proposal, and technically it’s straightforward. The main challenge would be refactoring some tests, which in this case means adding the
enabledparameter in a few places and deciding whether it should betrueorfalse.If that’s not an issue, I can start working on it.
Mairramer commentedon Feb 17, 2026
@justinmc @Piinks I’ve prepared an implementation and submitted it as a draft. However, I’m unsure whether the impact justifies the change.
Patterns such as
onChanged: condition ? (value) { ... } : nullwould be affected, resulting in a small breaking change. What would be the best way to proceed?justinmc commentedon Apr 28, 2026
@Mairramer Sorry I missed this notification here. I left a comment on the PR. I agree with your approach!
Add breaking change page for DropdownButton enabled property (#13430)
[material_ui] Add enabled parameter to DropdownButtonFormField (#12610)
github-actions commentedon Oct 27, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.