I am using Flutter Form Builder fields in my application. We have a "resilient" user experience, in that the application can be closed and re-opened, and your state will be restored as if you never left.
This includes, if you are editing a field so it's considered "dirty" (i.e., current value does not match initialValue) - this 'dirtiness state' will also be restored.
How can one achieve this at a field level? I do have a POC working(ish) - but it's having some consistency issues.
Please, can it be done without passing the rehydrated state to the FormBuilder constructor - because the widget in our app which hosts the FormBuilder is much higher up in the tree...
What would an ideal scenario look like?
FormBuilderDropdown(
initialValue: null,
currentValue: 'restored value' // but this only affects the initial state of the dropdown...
)
At the moment my 'hack' is calling a variety of FormBuilderState.setInternalFieldValue and FormBuilderFieldState.setValue - but it seems to work for simple text fields and switches, but not dropdowns