Validart class
The Validart class is the entry point for defining validation rules.
It provides a fluent API for validating different data types, including:
- Strings (
VString) - Booleans (
VBool) - Integers (
VInt) - Doubles (
VDouble) - Numeric values (
VNum) - Maps (
VMap) - Date (
VDate)
This class enables custom validation rules and supports chaining for complex validation logic.
Example
final v = Validart();
final validator = v.string().min(5).max(20);
print(validator.validate('Hello')); // true
print(validator.validate('Hi')); // false (too short)
- Available extensions
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
-
bool(
{String? message}) → VBool -
Creates a
VBoolinstance for validating boolean values. -
date(
{String? message}) → VDate -
Creates a
VDateinstance for validating date values. -
double(
{String? message}) → VDouble -
Creates a
VDoubleinstance for validating floating-point values. -
form(
VMap map, {GlobalKey< FormState> ? formKey, Map<String, dynamic> ? defaultValues}) → VForm -
Available on Validart, provided by the ValidartExtension extension
Creates aVFormfrom aVMapvalidation schema. -
int(
{String? message}) → VInt -
Creates a
VIntinstance for validating integer values. -
map(
Map< String, VType> object, {String? message}) → VMap -
Creates a
VMapinstance for validating objects with structured keys. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
num(
{String? message}) → VNum -
Creates a
VNuminstance for validating generic numeric values (intordouble). -
string(
{String? message}) → VString -
Creates a
VStringinstance for validating string values. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited