[FormBuilderField & FormBuilder]: Unexpected retention of initialValue
when coerced widget recreation
#1388
Closed
2 of 7 tasks
Labels
bug
Something isn't working
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
FormBuilderField : widget whenever coerced/forced to be recreated (ie maybe via ValueKey or UniqueKey), it's retaining the previous field's value.
In above code example
CountryInput = India
&StateInput = Gujarat
Expected Behavior
FormBuilderField : widget whenever coerced/forced to be recreated (ie maybe via ValueKey or UniqueKey), it should respect & attain the latest field's initial value rather than prioritizing the previous (stale) field's value,
In above code example
CountryInput = India
&StateInput = Gujarat
_state = null
)i.e
CountryInput = 'Japan'
&StateInput = ''
Steps To Reproduce
FormBuilderField
(let say initialValue = 'Gujarat')FormBuilderField
widget or any of it's ancestor. (for an instance, you can use UniqueKey)[With above sample code]
flutter_form_builder: ^9.2.1
Aditional information
Below is my console snippet when I followed above steps to reproduce
The text was updated successfully, but these errors were encountered: