You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`FormBuilderValidators.city()` - requires the field's value to be a valid city name.
677
-
-`FormBuilderValidators.country()` - requires the field's value to be a valid country name.
676
+
-`FormBuilderValidators.city()`: there is no equivalent to [this validator](https://github.com/flutter-form-builder-ecosystem/form_builder_validators/blob/17e982bb849dc68365f8fbc93d5a2323ee891c89/lib/src/identity/city_validator.dart#L53). Something close would be:
677
+
```dart
678
+
/// Old API:
679
+
FormBuilderValidators.city(
680
+
regex: RegExp(r'^[A-Z][a-zA-Z\s]+$'),
681
+
citiesWhitelist: ['CityA', 'CityB', 'CityC'],
682
+
citiesBlacklist: ['CityD', 'CityE'],
683
+
errorText: 'invalid city',
684
+
);
685
+
686
+
/// New API (expects input as String):
687
+
Validators.and([
688
+
Validators.match(
689
+
RegExp(r'^[A-Z][a-zA-Z\s]+$'),
690
+
matchMsg: (_)=>'invalid city'
691
+
),
692
+
Validators.inList(
693
+
['CityA', 'CityB', 'CityC'],
694
+
inListMsg: (_, __) => 'invalid city',
695
+
),
696
+
Validators.notInList(
697
+
['CityD', 'CityE'],
698
+
notInListMsg: (_, __) => 'invalid city',
699
+
),
700
+
]);
701
+
```
702
+
703
+
-`FormBuilderValidators.country()`: there is no equivalent to [this validator](https://github.com/flutter-form-builder-ecosystem/form_builder_validators/blob/17e982bb849dc68365f8fbc93d5a2323ee891c89/lib/src/identity/country_validator.dart#L42). Something close would be:
0 commit comments