maxLength static method

NiceValidationRule maxLength(
  1. int max, {
  2. String? message,
})

String must have maximum length.

Implementation

static NiceValidationRule maxLength(int max, {String? message}) => (value) {
      if (value is String && value.length > max) {
        return message ?? 'Maximum $max characters';
      }
      return null;
    };