form_bloc icon indicating copy to clipboard operation
form_bloc copied to clipboard

best approach for internal fields

Open ayushin opened this issue 4 years ago • 2 comments

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?

  1. InputFieldBloc with the id (that's what i do now)
  2. A field in the bloc class itself
  3. Perhaps a way to save global extra data in the bloc state?

What is your opinion?

Alex

ayushin avatar Jun 24 '20 15:06 ayushin

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.

JulianSwales avatar Jul 19 '20 21:07 JulianSwales

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?

ayushin avatar Jul 20 '20 05:07 ayushin