You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When resetting the form, the dropdowns "onChange" handler will fire twice in quick succession - one setting it to the "initialValue", then a second setting it back to the value it was before the reset button was clicked (essentially undoing the reset).
Expected Behavior
When resetting the form, the "onChange" should fire only once, and the passed value should be the "initialValue".
Steps To Reproduce
Using the above code snippet.
Run the code
Click the dropdown and change its value to "B"
Press the "reset" button
Note that it will not reset, but stay as "B", and the debug console will read
flutter: Changed value to A
flutter: Changed value to B
Aditional information
No response
The text was updated successfully, but these errors were encountered:
In my actual app (I'm assuming this is what's going on inside the demo code I provided too) - I have 4 FormBuilder fields.
2 * FormBuilderTextField
2 * FormBuilderDropdown
When I breakpoint the onChange, I can see that the form actually contains 6 field state objects - 2 for the text fields, and 4 for the dropdowns... it looks like for each dropdown there is a "FormBuilderDropdownState" and a "DropdownButtonFormFieldState".
When 'reset' is called on the FormBuilderDropdownState, it correctly fires onChanged and passes the initialValue.
However, when 'reset' is then called on the DropdownButtonFormFieldState this is when it resets it back to its current value.
I suspect this second state class isn't supposed to be in the fields collection - as it's just a double-up, one that breaks the functionality at that.
Is there an existing issue for this?
Package/Plugin version
9.2.1
Platforms
Flutter doctor
Flutter doctor
Minimal code example
Code sample
Current Behavior
When resetting the form, the dropdowns "onChange" handler will fire twice in quick succession - one setting it to the "initialValue", then a second setting it back to the value it was before the reset button was clicked (essentially undoing the reset).
Expected Behavior
When resetting the form, the "onChange" should fire only once, and the passed value should be the "initialValue".
Steps To Reproduce
Using the above code snippet.
Note that it will not reset, but stay as "B", and the debug console will read
Aditional information
No response
The text was updated successfully, but these errors were encountered: