string library

String validation rules for the Formix ecosystem.

Use this import for selective access to string validators only.

import 'package:formix_validators/string.dart';

final validator = StringRules.email(error: 'Invalid email');

Classes

AllOf<T, E>
Validates that ALL rules pass (AND logic).
AllOfCollect<T, E>
Validates that ALL rules pass, collecting all errors.
AllOfCollectLimited<T, E>
Validates that ALL rules pass, collecting errors up to a maximum limit.
AndThen<T, E>
Chains two validators, running the second only if the first passes.
AnyOf<T, E>
Validates that AT LEAST ONE rule passes (OR logic).
AnyOfCollect<T, E>
Validates that AT LEAST ONE rule passes, collecting all errors on failure.
CachedFormix<T, E>
A validator wrapper that caches the last validation result.
Chain<T, E>
Chains validators sequentially, only proceeding if the previous passes.
ConditionalLazyFormix<T, E>
A validator that conditionally creates itself based on a condition.
ErrorMessageFormatter<E>
Formats validation errors into user-facing messages.
Formix<T, E>
The root abstraction for all validators in the Formix ecosystem.
FunctionRule<T, E>
A rule defined by a validation function.
Invalid<T, E>
Represents a failed validation with a single error.
InvalidAll<T, E>
Represents a failed validation with multiple errors.
LazyFormix<T, E>
A validator that defers instantiation until first use.
LruCachedFormix<T, E>
A validator wrapper that caches multiple validation results using LRU eviction.
MapError<T, EIn, EOut>
Maps a validator's error type.
MapValue<TIn, TOut, E>
Maps a validator's output value.
Optional<T, E>
Wraps a validator to make it optional - skips validation when empty.
OptionalNullable<T, E>
Wraps a validator for nullable types - skips validation when null.
PredicateRule<T, E>
A rule defined by a predicate function.
Recover<T, E>
Recovers from validation errors with a default value.
Rule<T, E>
A single validation rule.
StringRules
Factory class for creating string validation rules.
Tap<T, E>
Applies side effects without affecting validation.
Transform<TIn, TOut, E>
Transforms a value before validation.
Valid<T, E>
Represents a successful validation.
Validate
Static factory class for creating validators.
ValidationResult<T, E>
Immutable result of a validation operation.
When<T, E>
Conditionally applies validation based on a predicate.
WhenElse<T, E>
Conditionally applies one of two validators based on a predicate.
WhenNot<T, E>
Inverse of When - validates only when condition is false.

Extensions

FormixExtensions on Formix<T, E>
Extension methods for Formix that provide ergonomic composition.