OneManTeam Validator
A lightweight and powerful Flutter form validation library that provides ready-to-use validators for common form fields such as email, phone number, password, numbers, and length checks.
OneManTeam Validator helps you write clean and reusable validation logic for TextFormField in Flutter.
✨ Features
OMTValidator provides several built-in validators:
- Required field validation
- Email validation
- Indian phone number validation
- Integer validation
- Double/decimal number validation
- Minimum length validation
- Maximum length validation
- Minimum numeric value validation
- Maximum numeric value validation
- Strong password validation
- Combine multiple validators using
compose
🚀 Getting started
Add the package to your pubspec.yaml:
dependencies:
onemanteam_validator: ^1.0.0
Then import the package:
import 'package:onemanteam_validator/onemanteam_validator.dart';
📌 Usage
Basic Example
TextFormField(
validator: OMTValidator.required(),
)
Email Validation
TextFormField(
validator: OMTValidator.email(),
)
Phone Number Validation (India)
TextFormField(
validator: OMTValidator.phoneNumberIN(),
)
Strong Password Validation
TextFormField(
validator: OMTValidator.strongPassword(),
)
Combine Multiple Validators
TextFormField(
validator: OMTValidator.compose([
OMTValidator.required(),
OMTValidator.email(),
]),
)
📦 Available Validators
| Validator | Description |
|---|---|
required() |
Checks if field is empty |
email() |
Validates email format |
phoneNumberIN() |
Validates Indian phone number |
isInt() |
Validates integer value |
isDouble() |
Validates decimal value |
minLength(int length) |
Minimum character length |
maxLength(int length) |
Maximum character length |
minValue(num value) |
Minimum numeric value |
maxValue(num value) |
Maximum numeric value |
strongPassword() |
Ensures strong password format |
compose([...]) |
Combine multiple validators |
📱 Example
A complete working example is available in the /example folder.
🤝 Contributing
Contributions, issues, and feature requests are welcome. Feel free to open an issue or submit a pull request.
📄 License
This package is released under the MIT License.