validator_kit 0.0.5
validator_kit: ^0.0.5 copied to clipboard
A lightweight, reusable, and extensible Flutter form validation package.

Validator Kit
A lightweight, reusable, customizable and null-safe Flutter form validation package that helps you validate forms with clean and readable code.
Perfect for Flutter forms, form validation, email validation, password validation, phone validation, URL validation, and custom input validation. Validator Kit makes it easy to build production-ready Flutter applications with a simple and consistent validation API.

✨ Features #
- ✅ Required Validator
- ✅ Email Validator
- ✅ Phone Validator
- ✅ URL Validator
- ✅ Username Validator
- ✅ Password Validator
- ✅ Confirm Password Validator
- ✅ Number Validator
- ✅ Pattern Validator
- ✅ Date Validator
- ✅ Credit Card Validator
- ✅ Minimum Value Validator
- ✅ Maximum Value Validator
- ✅ Range Validator
- ✅ Minimum Length Validator
- ✅ Maximum Length Validator
- ✅ Fixed Length Validator
- ✅ Contains Validator
- ✅ Starts With Validator
- ✅ Ends With Validator
- ✅ Equal Validator
- ✅ Not Equal Validator
- ✅ Combine Multiple Validators
- ✅ Validate Without TextFormField
- ✅ Custom Error Messages
- ✅ Null-safe
- ✅ Lightweight & Fast
📱 Preview #

🎬 Demo #

📦 Installation #
Add the package to your pubspec.yaml
dependencies:
validator_kit: 0.0.5
or install directly from pub.dev.
Then run
flutter pub get
🚀 Import #
import 'package:validator_kit/validator_kit.dart';
⚡ Quick Start #
TextFormField(
validator: ValidatorKit.combine([
ValidatorKit.required(),
ValidatorKit.email(),
]),
)
📚 Available Validators #
Required #
ValidatorKit.required()
Email #
ValidatorKit.email()
Phone #
ValidatorKit.phone()
Username #
ValidatorKit.username()
Password #
ValidatorKit.password()
Confirm Password #
ValidatorKit.confirmPassword(
() => passwordController.text,
)
URL #
ValidatorKit.url()
Number #
ValidatorKit.number()
Minimum Number #
ValidatorKit.min(18)
Maximum Number #
ValidatorKit.max(100)
Range Number #
ValidatorKit.range(
min: 18,
max: 60,
)
Length #
ValidatorKit.length(
min: 5,
max: 20,
)
Example:
validator: ValidatorKit.combine([
ValidatorKit.required(),
ValidatorKit.length(
min: 5,
max: 20,
),
])
Minimum Length #
ValidatorKit.minLength(8)
Maximum Length #
ValidatorKit.maxLength(30)
Contains #
ValidatorKit.contains('Flutter')
Example:
validator: ValidatorKit.combine([
ValidatorKit.required(),
ValidatorKit.contains('Flutter'),
])
Starts With #
ValidatorKit.startsWith('Mr.')
Example:
validator: ValidatorKit.combine([
ValidatorKit.required(),
ValidatorKit.startsWith('Mr.'),
])
Ends With #
ValidatorKit.endsWith('.com')
Example:
validator: ValidatorKit.combine([
ValidatorKit.required(),
ValidatorKit.endsWith('.com'),
])
Equal #
ValidatorKit.equal('Flutter')
Example:
validator: ValidatorKit.combine([
ValidatorKit.required(),
ValidatorKit.equal('Flutter'),
])
Not Equal #
ValidatorKit.notEqual('admin')
Example:
validator: ValidatorKit.combine([
ValidatorKit.required(),
ValidatorKit.notEqual('admin'),
])
Pattern #
ValidatorKit.pattern(
RegExp(r'^[A-Z]{2,5}-\d{4}-\d{4}$'),
message: 'Enter a valid Employee ID',
)
Credit Card #
ValidatorKit.creditCard()
Example:
validator: ValidatorKit.combine([
ValidatorKit.required(),
ValidatorKit.creditCard(),
])
Date #
ValidatorKit.date()
Example:
validator: ValidatorKit.combine([
ValidatorKit.required(),
ValidatorKit.date(),
])
Combine Validators #
validator: ValidatorKit.combine([
ValidatorKit.required(),
ValidatorKit.email(),
ValidatorKit.minLength(8),
])
Disable Validation #
If you want to disable validation conditionally:
ValidatorKit.none()
Example
validator: isGuest
? ValidatorKit.none()
: ValidatorKit.required(),
Custom Error Message #
ValidatorKit.email(
message: 'Please enter a valid email.',
)
💻 Complete Example #
TextFormField(
decoration: const InputDecoration(
labelText: 'Email',
),
validator: ValidatorKit.combine([
ValidatorKit.required(),
ValidatorKit.email(),
ValidatorKit.minLength(8),
]),
)
❤️ Why Validator Kit? #
Validator Kit is a modern Flutter validator package designed to simplify form validation in Flutter applications.
Whether you need an email validator, password validator, phone validator, URL validator, username validator, or custom input validation, Validator Kit provides a clean, reusable and developer-friendly API.
Why developers choose Validator Kit #
- 🚀 Lightweight and fast
- 🧩 Easy to integrate into any Flutter project
- 📝 Clean and readable API
- 🔄 Combine multiple validators easily
- 🎯 Supports custom error messages
- ✅ Fully null-safe
- ♻️ Reusable across multiple projects
- 📱 Perfect for Flutter Forms
- 💙 Production ready
🛣️ Roadmap #
- 🌍 Localization
- 🌐 IPv4 Validator
- 🌐 IPv6 Validator
- 🆔 IBAN Validator
- 🪪 UUID Validator
- 📍 Latitude & Longitude Validator
- 📦 File Validator
- 📅 Time Validator
- 🔥 Async Validators
- ⚙️ Validator Builder
- 🌎 Multi-language Error Messages
🤝 Contributing #
Contributions are welcome!
If you'd like to improve Validator Kit, feel free to open an issue or submit a pull request.
⭐ Support #
If you like this package, please give it a ⭐ on GitHub.
It helps the project grow and motivates future improvements.
🤝 Connect with Me #
If this package helps you, feel free to connect.
-
💻 GitHub: Dev-SohelRana
-
💼 LinkedIn: Md. Sohel Rana
-
🌐 Portfolio: https://dev-sohelrana.github.io/sohelrana-portfolio/
📄 License #
This project is licensed under the MIT License.
🔍 Keywords #
Flutter Validator • Form Validation • Validator Package • Flutter Forms • Email Validator • Password Validator • Phone Validator • URL Validator • Username Validator • Input Validation • Null Safe • Flutter Package • Dart Validator • Form Validator • Flutter Validation Library