Closed jbt-cii closed 3 years ago
I tried what I said before... using directly "ReactiveForm()" does not work either. Maybe because the final "ReactiveTextField" are inside StatefulWidget (in the "State" part). The FormGroup is declared outside (elsewhere higher in the widget tree). Did you try such a usage before?
OK I had a problem in my declaration of "FormGroup". I forgot to declare the good fields here:
FormGroup get form => fb.group(<String, dynamic>{
'name': ['', Validators.required],
'sendNotifications': [false, Validators.required],
});
Better with:
FormGroup get form => fb.group(<String, dynamic>{
'my_field_01': ['', Validators.required],
'my_field_02': ['', Validators.required],
'my_field_03': ['', Validators.required],
'sendNotifications': [false, Validators.required],
});
I close this issue :-)
Hi @jbt-cii,
Thanks for using Reactive Forms, I'm glad that you have solved the issue. Don't hesitate to open another if you have more questions.
Best regards
Thanks for your answer. Yes I have another question so I have just opened another issue: https://github.com/joanpablo/reactive_forms/issues/104
:-)
Hello,
Since yesterday, I try to use this great package with the configuration explained in that closed issue: https://github.com/joanpablo/reactive_forms/issues/99
Today I have the following error:
I began recently to develop in Flutter so maybe my questions are basics. And sorry if my sentences are not very good I'm French :-)
I try to implement the method explained in this example: https://github.com/joanpablo/reactive_forms/blob/master/example/lib/samples/simple_sample.dart
In my page (which extends StatefulWidget) and in the class "State" I declared:
After, I use "Cubit" (from BLOC):
And for the Cubit initial part I declared a widget like this:
=> I declared a "GestureDetector" widget because I separated the code into several parts and I did not find a way to manage the action :-)
My function "myFormSubmit":
=> So here I tried to pass by parameters the validated content of the fields
To manage the "input" fields I declared a generic global class:
And I call this above generic class like this:
So now with the error I get I think I should use "ReactiveForm" instead of "ReactiveFormBuilder" like this:
But I don't understand why your example doesn't show a "ReactiveForm" at all: https://github.com/joanpablo/reactive_forms/blob/master/example/lib/samples/simple_sample.dart