ValidationBuilder class

Constructors

ValidationBuilder({bool optional = false, String? requiredMessage, ValidatorOptions? options, String? localeName, FormValidatorLocale? locale})

Properties

hashCode int
The hash code for this object.
no setterinherited
optional bool
final
requiredMessage String?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
validations List<StringValidationCallback>
final

Methods

add(StringValidationCallback validator) ValidationBuilder
Adds new item to validations list, returns this instance
build() StringValidationCallback
Returns a validator function for FormInput
email([String? message]) ValidationBuilder
Value must be a well formatted email
ip([String? message]) ValidationBuilder
Value must be a well formatted IPv4 address
ipv6([String? message]) ValidationBuilder
Value must be a well formatted IPv6 address
maxLength(int maxLength, [String? message]) ValidationBuilder
Value length must be less than or equal to maxLength
minLength(int minLength, [String? message]) ValidationBuilder
Value length must be greater than or equal to minLength
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
or(Action<ValidationBuilder> left, Action<ValidationBuilder> right, {bool reverse = false}) ValidationBuilder
Throws error only if left and right validators throw error same time. If reverse is true left builder's error will be displayed otherwise right builder's error. Because this is default behaviour on most of the programming languages.
phone([String? message]) ValidationBuilder
Value must be a well formatted phone number
regExp(RegExp regExp, String message) ValidationBuilder
Value must match regExp
required([String? message]) ValidationBuilder
Value must not be null
reset() ValidationBuilder
Clears validation list and adds required validation if optional is false
test(String? value) String?
Tests value against defined validations
toString() String
A string representation of this object.
inherited
url([String? message]) ValidationBuilder
Value must be a well formatted URL address

Operators

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

Static Properties

globalLocale FormValidatorLocale
getter/setter pair
globalOptions ↔ ValidatorOptions
getter/setter pair

Static Methods

setLocale(String localeName) → void