form_bloc
form_bloc copied to clipboard
best approach for internal fields
Hi,
Imagine we use the form_bloc for CRUD and I need to keep track of the "hidden" id field.
What would be the best approach?
- InputFieldBloc
with the id (that's what i do now) - A field in the bloc class itself
- Perhaps a way to save global extra data in the bloc state?
What is your opinion?
Alex
Alex, What I did was in my onLoading create a map so I could lookup the returned choice in onSubmitting. It's a bit of a hack in my view to get around being unable to track the id. Especially since lots of people use sqflite and needs to do updates using that id. Julian.
Yeah I think it would be great to have an easy way to extend the state of the FormBloc with some sort of ExtraData like we have for FormFieldBloc's... @GiancarloCode what do you think?