Skip to content

Commit b223f31

Browse files
add more breaking changes instructions
1 parent 330caf4 commit b223f31

File tree

1 file changed

+32
-13
lines changed

1 file changed

+32
-13
lines changed

README-updated.md

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ see [override_form_builder_localizations_en](example/lib/override_form_builder_l
376376
- For this group of validators, it is expected to receive a `String` as user input. Thus, if your
377377
form widget does not guarantee a `String` input (it may receive an `Object`), you must wrap the
378378
equivalent validator with the type validator for strings. Thus, instead of
379-
`Validators.hasMin<Something>Chars(...)`, use `Validators.string(Validators.hasMin<Something>Chars(...))`
379+
`Validators.hasMin<Something>Chars(...)`, use `Validators.string(Validators.hasMin<Something>Chars(...))`.
380380
- `FormBuilderValidators.hasLowercaseChars(atLeast: n, regex: reg, errorText: 'some error')` is
381381
equivalent to `Validators.hasMinLowercaseChars(min: n, customLowercaseCounter:(input)=>reg.allMatches(input).length, hasMinLowercaseCharsMsg:(_, __)=>'some error')`
382382
- `FormBuilderValidators.hasNumericChars(atLeast: n, regex: reg, errorText: 'some error')` is
@@ -385,20 +385,39 @@ see [override_form_builder_localizations_en](example/lib/override_form_builder_l
385385
equivalent to `Validators.hasMinSpecialChars(min: n, customSpecialCounter:(input)=>reg.allMatches(input).length, hasMinSpecialCharsMsg:(_, __)=>'some error')`
386386
- `FormBuilderValidators.hasUppercaseChars(atLeast: n, regex: reg, errorText: 'some error')` is
387387
equivalent to `Validators.hasMinUppercaseChars(min: n, customUppercaseCounter:(input)=>reg.allMatches(input).length, hasMinUppercaseCharsMsg:(_, __)=>'some error')`
388-
389-
<<<<<<<<<<<<<<<CONTINUE THE TODO>>>>>>>>>>>>>>>
390-
- `FormBuilderValidators.isFalse()` - requires the field's to be false.
391-
- `FormBuilderValidators.isTrue()` - requires the field's to be true.
388+
- `FormBuilderValidators.isFalse(errorText:'some error')` is equivalent to `Validators.isFalse(isFalseMsg: (_)=>'some error')`
389+
- `FormBuilderValidators.isTrue(errorText:'some error')` is equivalent to `Validators.isTrue(isTrueMsg: (_)=>'some error')`
390+
391+
- Collection validators
392+
- `FormBuilderValidators.containsElement([v1, v2, v3], errorText:'some error')` is
393+
equivalent to `Validators.inList([v1, v2, v3], inListMsg: (_, __)=>'some error')`
394+
- `FormBuilderValidators.equalLength(n, ~~allowEmpty: allowEmpty~~, errorText:'some error')` is equivalent to
395+
`Validators.equalLength(n, equalLengthMsg: (_, __)=>'some error')`
396+
- The parameter `allowEmpty` was removed and additional logic must be provided to handle the
397+
case in which this parameter is true. Probably something like: `or([equalLength(0),equalLength(n)])`
398+
- `FormBuilderValidators.maxLength(n, errorText:'some error')` is equivalent to
399+
`Validators.maxLength(n, maxLengthMsg: (_, __)=>'some error')`
400+
- `FormBuilderValidators.minLength(n, errorText:'some error')` is equivalent to
401+
`Validators.minLength(n, minLengthMsg: (_, __)=>'some error')`
402+
- `FormBuilderValidators.range(minValue, maxValue, inclusive:inclusive, errorText:'some error')` is equivalent to:
403+
- `Validators.betweenLength(minValue, maxValue, betweenLengthMsg: (_)=>'some error')` if the
404+
user input is a collection. This is only for `inclusive:true`, thus if `inclusive` is `false`, the correct
405+
equivalent would be `Validators.betweenLength(minValue + 1, maxValue - 1, betweenLengthMsg: (_)=>'some error')`
406+
- `Validators.between(minValue, maxValue, minInclusive:inclusive, maxInclusive:inclusive, betweenMsg: (_1, _2, _3, _4, _5)=>'some error')`
407+
if the user input is numeric.
408+
- `FormBuilderValidators.unique([v1, v2, v3], errorText:'some error')`: there is no equivalent to this validator,
409+
thus, a custom validator should be implemented.
410+
- Example:
411+
```dart
412+
Validator<T> unique<T extends Object>(List<T> values, {String? errorText}){
413+
return (input){
414+
return values.where((element) => element == input).length > 1? errorText:null;
415+
};
392416
393-
### Collection validators
394-
395-
- `FormBuilderValidators.containsElement()` - requires the field's to be in the provided list.
396-
- `FormBuilderValidators.equalLength()` - requires the length of the field's value to be equal to the provided minimum length.
397-
- `FormBuilderValidators.maxLength()` - requires the length of the field's value to be less than or equal to the provided maximum size.
398-
- `FormBuilderValidators.minLength()` - requires the length of the field's value to be greater than or equal to the provided minimum length.
399-
- `FormBuilderValidators.range()` - requires the field's to be within a range.
400-
- `FormBuilderValidators.unique()` - requires the field's to be unique in the provided list.
417+
}
418+
```
401419
420+
// TODO continue from here...
402421
### Core validators
403422
404423
- `FormBuilderValidators.aggregate()` - runs the validators in parallel, collecting all errors.

0 commit comments

Comments
 (0)