@@ -1738,6 +1738,8 @@ class FormBuilderValidators {
17381738 ).validate;
17391739}
17401740
1741+ //********************************* NEW API ********************************************************************************
1742+
17411743/// A class that is used as an aggregator/namespace for all the available
17421744/// validators in this package.
17431745final class Validators {
@@ -1930,15 +1932,15 @@ final class Validators {
19301932 val.debugPrintValidator (next: next, logOnInput: logOnInput);
19311933
19321934 // Equality validators
1933- /// {@template validator_is_equal }
1935+ /// {@template validator_equal }
19341936 /// Creates a validator that checks if a given input matches `referenceValue`
19351937 /// using the equality (`==` ) operator.
19361938 ///
19371939 ///
19381940 /// ## Parameters
19391941 /// - `referenceValue` (`T` ): The value to compare against the input. This serves as
19401942 /// the reference for equality checking.
1941- /// - `isEqualMsg ` (`String Function(T input, T referenceValue)?` ): Optional
1943+ /// - `equalMsg ` (`String Function(T input, T referenceValue)?` ): Optional
19421944 /// custom error message generator. Takes the `input` and the `referenceValue`
19431945 /// as parameters and returns a custom error message.
19441946 ///
@@ -1955,14 +1957,14 @@ final class Validators {
19551957 /// ## Examples
19561958 /// ```dart
19571959 /// // Basic usage for password confirmation
1958- /// final confirmAction = isEqual ('Type this to confirm the action');
1960+ /// final confirmAction = Validator.equal ('Type this to confirm the action');
19591961 /// assert(confirmAction('Type this to confirm the action') == null); // null returned (validation passes)
19601962 /// assert(confirmAction(12345) != null); // Error message returned
19611963 ///
19621964 /// // Using custom error message
1963- /// final specificValueValidator = isEqual <int>(
1965+ /// final specificValueValidator = Validator.equal <int>(
19641966 /// 42,
1965- /// isEqualMsg : (_, value) => 'Value must be exactly $value',
1967+ /// equalMsg : (_, value) => 'Value must be exactly $value',
19661968 /// );
19671969 /// ```
19681970 ///
@@ -1972,20 +1974,20 @@ final class Validators {
19721974 /// - The error message uses the string representation of the value via
19731975 /// `toString()` , which might not be ideal for all types.
19741976 /// {@endtemplate}
1975- static Validator <T > isEqual <T extends Object ?>(
1977+ static Validator <T > equal <T extends Object ?>(
19761978 T value, {
1977- String Function (T input, T referenceValue)? isEqualMsg ,
1979+ String Function (T input, T referenceValue)? equalMsg ,
19781980 }) =>
1979- val.isEqual (value, isEqualMsg : isEqualMsg );
1981+ val.equal (value, equalMsg : equalMsg );
19801982
1981- /// {@template validator_is_not_equal }
1983+ /// {@template validator_not_equal }
19821984 /// Creates a validator that checks if a given input is not equal to
19831985 /// `referenceValue` using the not-equal (`!=` ) operator.
19841986 ///
19851987 /// ## Parameters
19861988 /// - `referenceValue` (`T` ): The reference value to compare against. Input must
19871989 /// not equal this value to pass validation.
1988- /// - `isNotEqualMsg ` (`String Function(T input, T referenceValue)?` ): Optional
1990+ /// - `notEqualMsg ` (`String Function(T input, T referenceValue)?` ): Optional
19891991 /// custom error message generator. Takes the `input` and the `referenceValue`
19901992 /// as parameters and returns a custom error message.
19911993 ///
@@ -2001,14 +2003,14 @@ final class Validators {
20012003 /// ## Examples
20022004 /// ```dart
20032005 /// // Basic usage with strings
2004- /// final validator = isNotEqual <String>('reserved');
2006+ /// final validator = Validators.notEqual <String>('reserved');
20052007 /// assert(validator('not-reserved') == null); // null (validation passes)
20062008 /// assert(validator('reserved') != null); // "Value must not be equal to reserved"
20072009 ///
20082010 /// // Custom error message
2009- /// final customValidator = isNotEqual <int>(
2011+ /// final customValidator = Validators.notEqual <int>(
20102012 /// 42,
2011- /// isNotEqualMsg : (_, value) => 'Please choose a number other than $value',
2013+ /// notEqualMsg : (_, value) => 'Please choose a number other than $value',
20122014 /// );
20132015 /// ```
20142016 ///
@@ -2018,13 +2020,14 @@ final class Validators {
20182020 /// - The error message uses the string representation of the value via
20192021 /// `toString()` , which might not be ideal for all types
20202022 /// {@endtemplate}
2021- static Validator <T > isNotEqual <T extends Object ?>(
2023+ static Validator <T > notEqual <T extends Object ?>(
20222024 T value, {
2023- String Function (T input, T referenceValue)? isNotEqualMsg ,
2025+ String Function (T input, T referenceValue)? notEqualMsg ,
20242026 }) =>
2025- val.isNotEqual (value, isNotEqualMsg : isNotEqualMsg );
2027+ val.notEqual (value, notEqualMsg : notEqualMsg );
20262028
20272029 // Required validators
2030+ // TODO remove verb 'is' from validators
20282031 /// {@template validator_is_required}
20292032 /// Generates a validator function that enforces required field validation for
20302033 /// form inputs. This validator ensures that a field has a non-null, non-empty
0 commit comments