CommonValidatorExtensions<T> extension
- on
-
- EzValidator<
T>
- EzValidator<
Methods
-
addMethod(
bool validWhen(T? v), [String? message]) → EzValidator< T> - add a custom validation
-
dependsOn(
{required bool condition(Map? ref), required EzValidator< T> then, EzValidator<T> ? orElse}) → EzValidator<T> - Dynamically adjust field validation based on another field's value.
-
isType(
Type type, [String? message]) → EzValidator< T> -
add a validation to check if the value is of type
type
message
is the message to return if the validation fails -
maxLength(
int maxLength, [String? message]) → EzValidator< T> -
add a validation to check if the value is less than maxLength
message
is the message to return if the validation fails -
minLength(
int minLength, [String? message]) → EzValidator< T> -
add a validation to check if the value is less than minLength
message
is the message to return if the validation fails -
required(
[String? message]) → EzValidator< T> -
add a validation to check if the value is null or empty
message
is the message to return if the validation fails -
transform(
T transformFunction(T)) → EzValidator< T> -
Transform the value before running the validation
transformFunction
is the function to run on the value -
when(
ValidationCallback< T> validator) → EzValidator<T> - adjust the validation based on the value of another field