-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade reactive_forms to ^15.0.0 #87
Upgrade reactive_forms to ^15.0.0 #87
Comments
I went ahead and created this PR in an effort to resolve this issue without having to use |
When we upgrade to ^15.0.0, we need to take care of this API change in |
@laogao You're correct, but this seems like a simple fix. Basically, our validators were previously The change to ^15.0.0 is simple. Anything that is currently a For example, res.add((control) {
if (control.value is String) {
if (!value.allowDigits! &&
(control.value as String).contains('.')) {
return {'allowDigits': value.allowDigits};
}
}
return null;
}); to looking like this: res.add(AllowDigitsValidator(value.allowDigits!)) where class AllowDigitsValidator extends Validator {
AllowDigitsValidator(this.allowDigits);
final bool allowDigits;
@override
Map<String, dynamic>? validate(AbstractControl control) {
// TODO: implement validate
if (control.value is String) {
if (!allowDigits && (control.value as String).contains('.')) {
return {'allowDigits': allowDigits};
}
}
return null;
}
} and, of course, |
Yup. I'm not saying it's complex or anything. Just that there is a breaking change in 15.0.0 we'll have to deal with. On a side note, this issue (joanpablo/reactive_forms#377) probably needs more commentary from someone other than me. In case you're interested. |
@laogao I'm trying to follow the issue, but there's a lot to take in there. Which issue in our project are we trying to resolve with that proposed change? I'm trying to understand why |
Say we have a text field that records a |
Ultimately this can be circumvented via a custom validator, the approach we've taken in #32 . When (if) that PR gets accepted, we no longer have to supply and maintain our own |
Closing as not needed. |
ReactiveForms
was recently updated to allowFormControl<dynamic>
to be passed as a control tofb.group
. This would allow us to register dynamicFormControl
s inlib/ui/survey_element_factory.dart
, which we should be able to do given that many elements can represent either aString
or anum
.Upgrading this dependency would allow me to resolve #71 because I have written some tests that ensure RadioGroup can handle being provided either an
int
or aString
.The text was updated successfully, but these errors were encountered: