form_bloc icon indicating copy to clipboard operation
form_bloc copied to clipboard

CRUD Support - How to Prefill form fields with data from database

Open v362 opened this issue 3 years ago • 1 comments

Hello, I'm currently using formBloc to create a form (screen 1) and then save the form field values to the database (SQFlite). The saved form is then displayed as read only inside a card widget (screen 2).

On this card, I want to be able to add a functionality (flatbutton -> on pressed) to EDIT/UPDATE the data by displaying the form (screen 1) but have all the fields pre-filled with data from the database. The issue I keep running into is that, the data in the database is saved as a String and is not accepted by the formBloc form fields.

I read about the form BLoc isEditing parameter but was not able to understand how to implement it using the set up I have above. Please let me know how to proceed.

Thanks

v362 avatar Jul 13 '20 05:07 v362

https://github.com/GiancarloCode/form_bloc/pull/312#issuecomment-1164240179

vasilich6107 avatar Mar 11 '23 18:03 vasilich6107