Validations class

A collection of common validation functions for form fields.

These validation functions return error messages when validation fails, or an empty string when validation passes. They are designed to work with the rules parameter of input widgets like TTextField.

Usage Example

TTextField(
  label: 'Email',
  rules: [
    Validations.requiredString('Email is required'),
    Validations.email('Please enter a valid email'),
  ],
)

Constructors

Validations()

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

email([String? message]) String Function(String?)
Creates a validation rule for email addresses.
maxLength(int max, [String? message]) String Function(String?)
Creates a validation rule that enforces a maximum string length.
maxValue(double max, [String? message]) String Function(double?)
Creates a validation rule that enforces a maximum numeric value.
minLength(int min, [String? message]) String Function(String?)
Creates a validation rule that enforces a minimum string length.
minValue(double min, [String? message]) String Function(double?)
Creates a validation rule that enforces a minimum numeric value.
range(double min, double max, [String? message]) String Function(double?)
Creates a validation rule that enforces a numeric range.
requiredString(String message) String Function(String?)
Creates a validation rule that requires a non-empty string.