FormRules class final
The primary entry point for all form validation.
Non-instantiable — every method returns a Validator builder with the first rule already applied.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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
Static Methods
-
addRule(
ValidationRule rule) → Validator - Adds a custom rule class.
-
alpha(
{String? message}) → Validator - Ensures the value contains only alphabetic characters.
-
alphaNumeric(
{String? message}) → Validator - Ensures the value contains only alphanumeric characters.
-
base64(
{String? message}) → Validator - Validates that the string is properly Base64 encoded.
-
contains(
String substring, {String? message}) → Validator - Ensures the value contains a specific substring.
-
countryCode(
{String? message}) → Validator - Validates a standard E.164 country dial code.
-
creditCard(
{String? message}) → Validator - Validates credit card numbers using the standard Luhn algorithm.
-
custom(
String? validator(String? value)) → Validator - Adds a custom inline validator.
-
date(
{String? message}) → Validator - Validates that the input is a valid date.
-
email(
{String? message}) → Validator - Validates an email address.
-
endsWith(
String suffix, {String? message}) → Validator - Ensures the value ends with a specific suffix.
-
equals(
String value, {String? message}) → Validator - Ensures the value exactly equals a hardcoded string.
-
hexColor(
{String? message}) → Validator - Validates a standard hex color string.
-
inList(
List< String> values, {String? message}) → Validator - Ensures the value exactly matches one of the items in the provided list.
-
ipAddress(
{bool v4Only = false, bool v6Only = false, String? message}) → Validator - Validates standard IPv4 and/or IPv6 addresses.
-
json(
{String? message}) → Validator - Validates that the string is valid JSON.
-
lowercase(
{String? message}) → Validator - Ensures the value is strictly lowercase.
-
macAddress(
{String? message}) → Validator - Validates a standard MAC address.
-
match(
String? getValue(), {String? message}) → Validator - Validates that the input matches another field.
-
maxLength(
int max, {String? message}) → Validator - Validates a maximum length.
-
minLength(
int min, {String? message}) → Validator - Validates a minimum length.
-
noSpecialChars(
{String allowed = '', String? message}) → Validator - Ensures there are no special characters.
-
notEquals(
String value, {String? message}) → Validator - Ensures the value does NOT equal a hardcoded string.
-
notInList(
List< String> values, {String? message}) → Validator - Ensures the value does NOT match any item in the provided list.
-
numeric(
{String? message}) → Validator - Validates that the input is numeric.
-
password(
{int minLength = 8, bool requireUppercase = true, bool requireLowercase = true, bool requireNumber = true, bool requireSpecialChar = true, String? message}) → Validator - An all-in-one strong password validator rule.
-
phone(
{RegExp? pattern, PhoneCountry? country, String? message}) → Validator -
Validates a phone number, optionally enforcing a specific
country. -
regex(
RegExp pattern, {required String message}) → Validator - Validates against a custom regex pattern.
-
required(
{String? message}) → Validator - Ensures the field is not null or empty.
-
slug(
{String? message}) → Validator - Validates a URL-friendly slug.
-
startsWith(
String prefix, {String? message}) → Validator - Ensures the value starts with a specific prefix.
-
uppercase(
{String? message}) → Validator - Ensures the value is strictly uppercase.
-
url(
{bool requireHttps = false, String? message}) → Validator - Validates a URL.
-
uuid(
{String? message}) → Validator - Validates a standard UUID.