Let the options of a select change while the form is open - #89
Merged
Merged
Conversation
Both select controllers get setOptions(List<V>). A selected value that is not on the new list is cleared as a program write, like prefill, so an untouched field stays quiet; widgets rebuild even when the value stayed. The single select now copies the list it is given, as the multi select always did. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
KamilSztandur
requested review from
PiotrRogulski and
mateusz-pietras
as code owners
September 20, 2026 19:44
|
Docs preview: https://advanced-forms-f03faufh3-leancode.vercel.app Built from 6a6b7b9; the landing page is at |
mateusz-pietras
approved these changes
Sep 21, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The list of options in a select is fixed when the field is created. There is no way to swap it later. That rules out the ordinary dependent dropdown: the instructors you can pick depend on the aircraft you chose, the cities depend on the country, the list arrives from the server after the form is already on screen. Someone porting two real forms had to give up on the built-in select for this. It is a gap, not a design choice.
Solution
setOptions(newList)on both select controllers. It replaces the list and takes care of the value:prefill, not as a user edit. So a prefilled field the user never touched stays quiet until submit, while a field the user had picked from shows its "required" error right away.Typical use is a listener on the other field:
One side effect: the single select now copies the list it is given, which the multi select already did.
optionsis read-only on both.In this PR
setOptionsonAdvancedSingleSelectFieldControllerandAdvancedMultiSelectFieldController.==warning about server copies of options, SKILL.md and a changelog entry.flutter analyzeclean, all 271 tests pass.🤖 Generated with Claude Code