Closed airychkov closed 9 months ago
hi. could you explain the reason on adding this additional check?
Hi! I have part of form as FormGroup disabled by default. Data in disabled part is valid (but it's not matter) User can activate FormGroup by switch if needed Main Form -> FormGroup with switch -> Sub FormGroup with data and validators By default disabled part of From is invalid. I think if part form is disabled no need to check valid and show message.
I hope I can explain
If you have
required SomeType type
variable in your model
- the calling of model
on invalid form
could cause the crash off the app cause null
ish value from form will be casted to non nullable type. This is why the warning was added.
So it will be better to check your form and validators rather than silencing the possible issue warning.
Maybe I don't something. In debug I see: no errors and form valid = false and invalid = false And form is valid with default values. I
See attachment
@airychkov it seems that disabled forms are not valid. I do not why You can clarify here https://github.com/joanpablo/reactive_forms
@airychkov this issue has more information https://github.com/joanpablo/reactive_forms/issues/172
anyway, the form behavior is out of scope for this library so I'm closing the issue
Hi @airychkov! Your issue has been closed. If we were helpful don't forget to star the repo.
Please check our reactive_forms_widget package
We would appreciate sponsorship subscription or one time donation https://github.com/sponsors/artflutter
Hey @airychkov check https://pub.dev/packages/reactive_forms_generator/versions/4.6.0-beta.1
I updated the if
logic so it should spam less.
Hello! That's better! no extra logs Thank you
By the way I made few components for my project: CupertinoPicker, flutter_xlider. I can share it.
Would be a nice addition Could you share them in some way so I can include into the packages
rf_comonents.zip components in attachment, if you want I can make it better.
add if (!currentForm.valid && if (!currentForm.disbaled) {) {
to if (!currentForm.valid) { debugPrint('[\${path ?? '$classNameFull'}]\n┗━ Avoid calling
model
on invalid form. Possible exceptions for non-nullable fields which should be guarded byrequired
validator.'); }