@@ -511,6 +511,23 @@ class FormBuilderValidators {
511
511
checkNullOrEmpty: checkNullOrEmpty,
512
512
).validate;
513
513
514
+ /// [FormFieldValidator] that requires the field's value to be a valid time zone.
515
+
516
+ /// ## Parameters:
517
+ /// - [errorText] The error message when the time zone is invalid.
518
+ /// - [checkNullOrEmpty] Whether to check for null or empty values.
519
+ /// {@macro time_zone_template}
520
+ static FormFieldValidator <String > timeZone ({
521
+ List <String >? validTimeZones,
522
+ String ? errorText,
523
+ bool checkNullOrEmpty = true ,
524
+ }) =>
525
+ TimeZoneValidator (
526
+ validTimeZones: validTimeZones,
527
+ errorText: errorText,
528
+ checkNullOrEmpty: checkNullOrEmpty,
529
+ ).validate;
530
+
514
531
/// [FormFieldValidator] that requires the field's value to a valid file extension.
515
532
///
516
533
/// ## Parameters:
@@ -695,6 +712,164 @@ class FormBuilderValidators {
695
712
checkNullOrEmpty: checkNullOrEmpty,
696
713
).validate;
697
714
715
+ /// [FormFieldValidator] that requires the field's value to be a valid city.
716
+ ///
717
+ /// ## Parameters:
718
+ /// - [regex] The regex pattern to match.
719
+ /// - [citiesWhitelist] The list of allowed cities.
720
+ /// - [citiesBlacklist] The list of disallowed cities.
721
+ /// - [errorText] The error message when the city is invalid.
722
+ /// - [checkNullOrEmpty] Whether to check for null or empty values.
723
+ static FormFieldValidator <String > city ({
724
+ RegExp ? regex,
725
+ List <String > citiesWhitelist = const < String > [],
726
+ List <String > citiesBlacklist = const < String > [],
727
+ String ? errorText,
728
+ bool checkNullOrEmpty = true ,
729
+ }) =>
730
+ CityValidator (
731
+ regex: regex,
732
+ citiesWhitelist: citiesWhitelist,
733
+ citiesBlacklist: citiesBlacklist,
734
+ errorText: errorText,
735
+ checkNullOrEmpty: checkNullOrEmpty,
736
+ ).validate;
737
+
738
+ /// [FormFieldValidator] that requires the field's value to be a valid country.
739
+ ///
740
+ /// ## Parameters:
741
+ /// - [countryWhitelist] The list of allowed countries.
742
+ /// - [countryBlacklist] The list of disallowed countries.
743
+ /// - [errorText] The error message when the country is invalid.
744
+ /// - [checkNullOrEmpty] Whether to check for null or empty values.
745
+ static FormFieldValidator <String > country ({
746
+ List <String > countryWhitelist = const < String > [],
747
+ List <String > countryBlacklist = const < String > [],
748
+ String ? errorText,
749
+ bool checkNullOrEmpty = true ,
750
+ }) =>
751
+ CountryValidator (
752
+ countryWhitelist: countryWhitelist,
753
+ countryBlacklist: countryBlacklist,
754
+ errorText: errorText,
755
+ checkNullOrEmpty: checkNullOrEmpty,
756
+ ).validate;
757
+
758
+ /// [FormFieldValidator] that requires the field's value to be a valid first name.
759
+ ///
760
+ /// ## Parameters:
761
+ /// - [regex] The regex pattern to match.
762
+ /// - [firstNameWhitelist] The list of allowed first names.
763
+ /// - [firstNameBlacklist] The list of disallowed first names.
764
+ /// - [errorText] The error message when the first name is invalid.
765
+ /// - [checkNullOrEmpty] Whether to check for null or empty values.
766
+ static FormFieldValidator <String > firstName ({
767
+ RegExp ? regex,
768
+ List <String > firstNameWhitelist = const < String > [],
769
+ List <String > firstNameBlacklist = const < String > [],
770
+ String ? errorText,
771
+ bool checkNullOrEmpty = true ,
772
+ }) =>
773
+ FirstNameValidator (
774
+ regex: regex,
775
+ firstNameWhitelist: firstNameWhitelist,
776
+ firstNameBlacklist: firstNameBlacklist,
777
+ errorText: errorText,
778
+ checkNullOrEmpty: checkNullOrEmpty,
779
+ ).validate;
780
+
781
+ /// [FormFieldValidator] that requires the field's value to be a valid last name.
782
+ ///
783
+ /// ## Parameters:
784
+ /// - [regex] The regex pattern to match.
785
+ /// - [lastNameWhitelist] The list of allowed last names.
786
+ /// - [lastNameBlacklist] The list of disallowed last names.
787
+ /// - [errorText] The error message when the last name is invalid.
788
+ /// - [checkNullOrEmpty] Whether to check for null or empty values.
789
+ static FormFieldValidator <String > lastName ({
790
+ RegExp ? regex,
791
+ List <String > lastNameWhitelist = const < String > [],
792
+ List <String > lastNameBlacklist = const < String > [],
793
+ String ? errorText,
794
+ bool checkNullOrEmpty = true ,
795
+ }) =>
796
+ LastNameValidator (
797
+ regex: regex,
798
+ lastNameWhitelist: lastNameWhitelist,
799
+ lastNameBlacklist: lastNameBlacklist,
800
+ errorText: errorText,
801
+ checkNullOrEmpty: checkNullOrEmpty,
802
+ ).validate;
803
+
804
+ /// [FormFieldValidator] that requires the field's value to be a valid passport number.
805
+ ///
806
+ /// ## Parameters:
807
+ /// - [regex] The regex pattern to match.
808
+ /// - [passportNumberWhitelist] The list of allowed passport numbers.
809
+ /// - [passportNumberBlacklist] The list of disallowed passport numbers.
810
+ /// - [errorText] The error message when the passport number is invalid.
811
+ /// - [checkNullOrEmpty] Whether to check for null or empty values.
812
+ static FormFieldValidator <String > passport ({
813
+ RegExp ? regex,
814
+ List <String > passportNumberWhitelist = const < String > [],
815
+ List <String > passportNumberBlacklist = const < String > [],
816
+ String ? errorText,
817
+ bool checkNullOrEmpty = true ,
818
+ }) =>
819
+ PassportNumberValidator (
820
+ regex: regex,
821
+ passportNumberWhitelist: passportNumberWhitelist,
822
+ passportNumberBlacklist: passportNumberBlacklist,
823
+ errorText: errorText,
824
+ checkNullOrEmpty: checkNullOrEmpty,
825
+ ).validate;
826
+
827
+ /// [FormFieldValidator] that requires the field's value to be a valid state.
828
+ ///
829
+ /// ## Parameters:
830
+ /// - [regex] The regex pattern to match.
831
+ /// - [stateWhitelist] The list of allowed states.
832
+ /// - [stateBlacklist] The list of disallowed states.
833
+ /// - [errorText] The error message when the state is invalid.
834
+ /// - [checkNullOrEmpty] Whether to check for null or empty values.
835
+ static FormFieldValidator <String > state ({
836
+ RegExp ? regex,
837
+ List <String > stateWhitelist = const < String > [],
838
+ List <String > stateBlacklist = const < String > [],
839
+ String ? errorText,
840
+ bool checkNullOrEmpty = true ,
841
+ }) =>
842
+ StateValidator (
843
+ regex: regex,
844
+ stateWhitelist: stateWhitelist,
845
+ stateBlacklist: stateBlacklist,
846
+ errorText: errorText,
847
+ checkNullOrEmpty: checkNullOrEmpty,
848
+ ).validate;
849
+
850
+ /// [FormFieldValidator] that requires the field's value to be a valid street address.
851
+ ///
852
+ /// ## Parameters:
853
+ /// - [regex] The regex pattern to match.
854
+ /// - [streetWhitelist] The list of allowed street addresses.
855
+ /// - [streetBlacklist] The list of disallowed street addresses.
856
+ /// - [errorText] The error message when the street address is invalid.
857
+ /// - [checkNullOrEmpty] Whether to check for null or empty values.
858
+ static FormFieldValidator <String > street ({
859
+ RegExp ? regex,
860
+ List <String > streetWhitelist = const < String > [],
861
+ List <String > streetBlacklist = const < String > [],
862
+ String ? errorText,
863
+ bool checkNullOrEmpty = true ,
864
+ }) =>
865
+ StreetValidator (
866
+ regex: regex,
867
+ streetWhitelist: streetWhitelist,
868
+ streetBlacklist: streetBlacklist,
869
+ errorText: errorText,
870
+ checkNullOrEmpty: checkNullOrEmpty,
871
+ ).validate;
872
+
698
873
/// [FormFieldValidator] that requires the field's value to be a valid
699
874
/// password.
700
875
///
@@ -1139,6 +1314,21 @@ class FormBuilderValidators {
1139
1314
checkNullOrEmpty: checkNullOrEmpty,
1140
1315
).validate;
1141
1316
1317
+ /// [FormFieldValidator] that requires the field's value to be a valid prime number.
1318
+ ///
1319
+ /// ## Parameters:
1320
+ /// - [errorText] The error message when the value is not a prime number.
1321
+ /// - [checkNullOrEmpty] Whether to check for null or empty values.
1322
+ /// {@macro prime_number_template}
1323
+ static FormFieldValidator <T > primeNumber <T >({
1324
+ String ? errorText,
1325
+ bool checkNullOrEmpty = true ,
1326
+ }) =>
1327
+ PrimeNumberValidator <T >(
1328
+ errorText: errorText,
1329
+ checkNullOrEmpty: checkNullOrEmpty,
1330
+ ).validate;
1331
+
1142
1332
/// [FormFieldValidator] that requires the field's value to contain only alphabetical characters.
1143
1333
///
1144
1334
/// ## Parameters:
@@ -1377,6 +1567,24 @@ class FormBuilderValidators {
1377
1567
checkNullOrEmpty: checkNullOrEmpty,
1378
1568
).validate;
1379
1569
1570
+ /// [FormFieldValidator] that requires the field's value to be a valid DUNS number.
1571
+ ///
1572
+ /// ## Parameters:
1573
+ /// - [regex] The regex pattern to match.
1574
+ /// - [errorText] The error message when the DUNS number is invalid.
1575
+ /// - [checkNullOrEmpty] Whether to check for null or empty values.
1576
+ /// {@macro duns_template}
1577
+ static FormFieldValidator <String > duns ({
1578
+ RegExp ? regex,
1579
+ String ? errorText,
1580
+ bool checkNullOrEmpty = true ,
1581
+ }) =>
1582
+ DunsValidator (
1583
+ regex: regex,
1584
+ errorText: errorText,
1585
+ checkNullOrEmpty: checkNullOrEmpty,
1586
+ ).validate;
1587
+
1380
1588
/// [FormFieldValidator] that requires the field's value to be a valid ISBN.
1381
1589
///
1382
1590
/// ## Parameters:
@@ -1405,6 +1613,54 @@ class FormBuilderValidators {
1405
1613
checkNullOrEmpty: checkNullOrEmpty,
1406
1614
).validate;
1407
1615
1616
+ /// [FormFieldValidator] that requires the field's value to be a valid language code.
1617
+ ///
1618
+ /// ## Parameters:
1619
+ /// - [regex] The regex pattern to match.
1620
+ /// - [languageCodeWhitelist] The list of allowed language codes.
1621
+ /// - [languageCodeBlacklist] The list of disallowed language codes.
1622
+ /// - [errorText] The error message when the language code is invalid.
1623
+ /// - [checkNullOrEmpty] Whether to check for null or empty values.
1624
+ /// {@macro language_code_template}
1625
+ static FormFieldValidator <String > languageCode ({
1626
+ RegExp ? regex,
1627
+ List <String > languageCodeWhitelist = const < String > [],
1628
+ List <String > languageCodeBlacklist = const < String > [],
1629
+ String ? errorText,
1630
+ bool checkNullOrEmpty = true ,
1631
+ }) =>
1632
+ LanguageCodeValidator (
1633
+ regex: regex,
1634
+ languageCodeWhitelist: languageCodeWhitelist,
1635
+ languageCodeBlacklist: languageCodeBlacklist,
1636
+ errorText: errorText,
1637
+ checkNullOrEmpty: checkNullOrEmpty,
1638
+ ).validate;
1639
+
1640
+ /// [FormFieldValidator] that requires the field's value to be a valid license plate.
1641
+ ///
1642
+ /// ## Parameters:
1643
+ /// - [regex] The regex pattern to match.
1644
+ /// - [licensePlateWhitelist] The list of allowed license plates.
1645
+ /// - [licensePlateBlacklist] The list of disallowed license plates.
1646
+ /// - [errorText] The error message when the license plate is invalid.
1647
+ /// - [checkNullOrEmpty] Whether to check for null or empty values.
1648
+ /// {@macro license_plate_template}
1649
+ static FormFieldValidator <String > licensePlate ({
1650
+ RegExp ? regex,
1651
+ List <String > licensePlateWhitelist = const < String > [],
1652
+ List <String > licensePlateBlacklist = const < String > [],
1653
+ String ? errorText,
1654
+ bool checkNullOrEmpty = true ,
1655
+ }) =>
1656
+ LicensePlateValidator (
1657
+ regex: regex,
1658
+ licensePlateWhitelist: licensePlateWhitelist,
1659
+ licensePlateBlacklist: licensePlateBlacklist,
1660
+ errorText: errorText,
1661
+ checkNullOrEmpty: checkNullOrEmpty,
1662
+ ).validate;
1663
+
1408
1664
/// [FormFieldValidator] that requires the field's value to be a valid
1409
1665
/// UUID.
1410
1666
///
@@ -1421,4 +1677,28 @@ class FormBuilderValidators {
1421
1677
errorText: errorText,
1422
1678
checkNullOrEmpty: checkNullOrEmpty,
1423
1679
).validate;
1680
+
1681
+ /// [FormFieldValidator] that requires the field's value to be a valid VIN.
1682
+ ///
1683
+ /// ## Parameters:
1684
+ /// - [regex] The regex pattern to match.
1685
+ /// - [vinWhitelist] The list of allowed VINs.
1686
+ /// - [vinBlacklist] The list of disallowed VINs.
1687
+ /// - [errorText] The error message when the VIN is invalid.
1688
+ /// - [checkNullOrEmpty] Whether to check for null or empty values.
1689
+ /// {@macro vin_template}
1690
+ static FormFieldValidator <String > vin ({
1691
+ RegExp ? regex,
1692
+ List <String > vinWhitelist = const < String > [],
1693
+ List <String > vinBlacklist = const < String > [],
1694
+ String ? errorText,
1695
+ bool checkNullOrEmpty = true ,
1696
+ }) =>
1697
+ VinValidator (
1698
+ regex: regex,
1699
+ vinWhitelist: vinWhitelist,
1700
+ vinBlacklist: vinBlacklist,
1701
+ errorText: errorText,
1702
+ checkNullOrEmpty: checkNullOrEmpty,
1703
+ ).validate;
1424
1704
}
0 commit comments