Rules class

A utility class that provides convenient methods to create instances of various validation rules.

Constructors

Rules()

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

alpha({String? message}) ValidationRule<String>
Creates an Alpha validation rule.
alphaDash({String? message}) ValidationRule<String?>
Creates an AlphaDash validation rule.
alphaNum({String? message}) ValidationRule<String?>
Creates an AlphaNum validation rule.
between({required num min, required num max, String? message}) ValidationRule<String>
Creates a Between validation rule.
boolean({String? message}) ValidationRule<String>
Creates a Boolean validation rule.
date({String? message}) ValidationRule<String>
Creates a Date validation rule.
dateAfter(DateTime date, {String? message}) ValidationRule<DateTime>
Creates a DateAfter validation rule.
dateAfterFromString(String date, {String? format, String? message}) ValidationRule<DateTime?>
Creates a DateAfter validation rule from a string date representation.
dateBefore(DateTime date, {String? message}) ValidationRule<DateTime>
Creates a DateBefore validation rule.
dateBeforeFromString(String date, {String? format, String? message}) ValidationRule<DateTime?>
Creates a DateBefore validation rule from a string date representation.
different<T>(String otherField, {String? message}) ValidationRule<T>
Creates a Different validation rule.
digits({required int digitLength, String? message}) ValidationRule<String>
Creates a Digits validation rule.
digitsBetween({required num min, required num max, String? message}) ValidationRule<String>
Creates a DigitsBetween validation rule.
email({String? message}) ValidationRule<String>
Creates an Email validation rule.
fileSize(int maxSizeInBytes, {String? message}) ValidationRule<File?>
Creates a FileSizeRule validation rule.
fileSizeInMegabytes(int maxSizeInMegabytes, {String? message}) ValidationRule<File?>
Creates a FileSizeRule validation rule with the size in megabytes.
fileType(List<String> allowedMimeTypes, {String? message}) ValidationRule<File?>
Creates a FileTypeRule validation rule.
inList<T>(List<T> validValues, {String? message}) ValidationRule<T>
Creates an InList validation rule.
integer({String? message}) ValidationRule<String>
Creates an Integer validation rule.
isFalse<T>({String? message}) ValidationRule<T>
Creates an IsFalse validation rule.
isTrue<T>({String? message}) ValidationRule<T>
Creates an IsTrue validation rule.
maxLength(int max, {String? message}) ValidationRule<String>
Creates a MaxLength validation rule.
maxSelected<T extends Iterable<G>, G>(int min, {String? message}) ValidationRule<T>
Creates a MaxSelected validation rule.
maxValue(int max, {String? message}) ValidationRule<num>
Creates a MaxValue validation rule.
minLength(int min, {String? message}) ValidationRule<String>
Creates a MinLength validation rule.
minSelected<T extends Iterable<G>, G>(int min, {String? message}) ValidationRule<T>
Creates a MinSelected validation rule.
minValue(int min, {String? message}) ValidationRule<num>
Creates a MinValue validation rule.
notInList<T>(List<T> invalidValues, {String? message}) ValidationRule<T>
Creates a NotInList validation rule.
numeric({String? message}) ValidationRule<String?>
Creates a Numeric validation rule.
optional<T>() ValidationRule<T>
phoneNumber({String? message}) ValidationRule<String>
Creates a PhoneNumber validation rule. This rule checks if a string is a valid phone number. It can include a custom validation message.
rangeSelected<T>({required int min, required int max, String? message}) ValidationRule<Iterable<T>?>
Creates a RangeSelected validation rule.
regex(RegExp regex, {String? message}) ValidationRule<String>
Creates a Regex validation rule.
required<T>({String? message}) ValidationRule<T>
Creates a Required validation rule.
requiredIf<T>(String? otherFieldName, {dynamic equalTo, String? message}) ValidationRule<T>
Creates a RequiredIf validation rule.
requiredIfCondition<T>(bool condition()?, {String? message}) ValidationRule<T>
Creates a RequiredIf validation rule based on a condition.
same<T>({required String otherField, String? message}) ValidationRule<T>
Creates a Same validation rule.
size(int size, {String? message}) ValidationRule<String>
Creates a Size validation rule.
url({String? message}) ValidationRule<String>
Creates a Url validation rule.