flutter_form_builder set value of field programmatically not working flutter_form_builder set value of field programmatically not working flutter flutter

flutter_form_builder set value of field programmatically not working


It is very simple and clarified in the official docs,

You can either change the value of one field at a time like so:

_formKey.currentState.fields['color_picker'].didChange(Colors.black);

Or multiple fields value like so:

_formKey.currentState.patchValue({  'age': '50',  'slider': 6.7,  'filter_chip': ['Test 1'],  'choice_chip': 'Test 2',  'rate': 4,  'chips_test': [    Contact('Andrew', 'stock@man.com', 'https://d2gg9evh47fn9z.cloudfront.net/800px_COLOURBOX4057996.jpg'),  ],});

Refer to this part in the docs: flutter_form_builder: Programmatically changing field value