0 purchases
validation assistant
Very simple and light form validation assistant. #
Use your own validation functions with great convenience. #
Features #
Very simple.
Very light.
Zero dependencies.
Getting started #
flutter pub get validation_assistant
copied to clipboard
or
dependencies:
validation_assistant: 1.1.2
copied to clipboard
Usage #
final validationAssistant = ValidationAssistant();
...
// with default messages
TextFormField(
...
validator: validationAssistant
..required()
..maxLength(10)
..regExp(r'^\d+$')
)
// with custom messages.
TextFormField(
...
validator: validationAssistant
..required('custom error message')
..maxLength(10, 'custom error message')
..regExp(r'^\d+$', 'custom error message')
)
copied to clipboard
You can add your own function to check.
final validationAssistant = ValidationAssistant();
...
final String? customValidationFunction(String? value) {
if (value < 5) {
return 'custom error message';
}
return null;
}
...
TextFormField(
...
validator: validationAssistant
..required('custom error message')
..add(customValidationFunction)
)
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.