Is there an existing issue for this?
Package/Plugin version
9.2.1
Platforms
Flutter doctor
Flutter doctor
Minimal code example
Code sample
FormBuilder(
child: Column(
children: [
Builder(
builder: (context) {
return ElevatedButton(onPressed: (){
FormBuilder.of(context)!.reset();
}, child: Text('reset'));
}
),
FormBuilderDropdown(
name: 'test',
initialValue: 'A',
items: [
DropdownMenuItem(child: Text('A'), value: 'A'),
DropdownMenuItem(child: Text('B'), value: 'B')
],
onChanged: (value) {
print('Changed value to $value');
},
),
],
),
),
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.
- 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
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