equalLength<T> static method

FormFieldValidator<T> equalLength<T>(
  1. int length, {
  2. bool allowEmpty = false,
  3. String? errorText,
  4. bool checkNullOrEmpty = true,
})

FormFieldValidator that requires the length of the field to be equal to the provided length. Works with String, iterable, and int types.

Parameters:

  • length The length to compare.
  • allowEmpty Whether the field's value can be empty (default: false).
  • errorText The error message when the length is invalid.
  • checkNullOrEmpty Whether to check for null or empty values.

Implementation

static FormFieldValidator<T> equalLength<T>(
  int length, {
  bool allowEmpty = false,
  String? errorText,
  bool checkNullOrEmpty = true,
}) => EqualLengthValidator<T>(
  length,
  allowEmpty: allowEmpty,
  errorText: errorText,
  checkNullOrEmpty: checkNullOrEmpty,
).validate;