Open Dionnie123 opened 3 months ago
Control value accessors are used to convert values from form state to control consumable format and back. They are not for retrieving the values.
Use .model getter to retrieve your model https://github.com/artflutter/reactive_forms_generator/blob/master/packages/reactive_forms_generator/example/lib/docs/group/group_form.dart#L152
And then proceed with saving
Control value accessors are used with fields, and not with generator
@vasilich6107 reactive color picker was built to accept Color type and return Color type, what approach do you recommend if I want the color field to accept Color type and return int type or vice-versa? should I make my custom color picker from scratch?
Color could be created from int
const Color(int value)
and Colors.red.value
returns int
so you can retrieve int value from color when putting the item to database using value
I use freezed + reactive forms generator and I have this color picker field.
I'm struggling to integrate the ControlValueAccessor with my form management and database saving processes. Despite using reactive_forms_generator to generate form controls, I find it challenging to exert control over how values are handled, particularly with saving data to the database.