MaxLengthValidator class

A validator that ensures the string does not exceed max characters.

Useful for form fields like name, title, descriptions, etc.

Inheritance

Constructors

MaxLengthValidator({required int max, String message = 'Too long'})
Creates a MaxLengthValidator.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
max int
The maximum allowed length for the input.
final
message String
The error message returned if the input exceeds max length.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(String value) String?
Returns null if valid, or an error message if invalid.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited