vMaxLen function

DraftModeValidator<String> vMaxLen(
  1. int length
)

Returns a validator that rejects strings longer than length.

Implementation

DraftModeValidator<String> vMaxLen(int length) {
  return _typedValidator<String>(
    type: DraftModeValidatorType.maxLength,
    payload: length,
    delegate: (DraftModeValidationValueContext? context, String? value) {
      if (value != null && value.length > length) {
        return DraftModeValidationMaxLength(length);
      }
      return null;
    },
  );
}