MaxLengthRule class
A validation rule that checks if the value's length does not exceed a maximum length.
- Inheritance
-
- Object
- ValidatorRule
- MaxLengthRule
Constructors
- MaxLengthRule(int maxLength, {String? errorMessage})
-
Creates a MaxLengthRule with the given
maxLengthand an optionalerrorMessage.const
Properties
-
defaultMessage
→ Map<
String, String> -
Default error messages for different locales.
no setteroverride
- errorMessage → String?
-
The error message to be displayed if validation fails.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxLength → int
-
The maximum allowed length for the field.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
isValid(
BuildContext context, String? value) → String? -
Validates if the
valueis at most maxLength characters long.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