validator_kit 0.0.1
validator_kit: ^0.0.1 copied to clipboard
A lightweight, reusable, and extensible Flutter form validation package.
[Validator Kit Banner]
Validator Kit
A lightweight, reusable, customizable and null-safe Flutter form validation package.
[assets/logo.png]
✨ Features #
- ✅ Required Validator
- ✅ Email Validator
- ✅ Phone Validator
- ✅ URL Validator
- ✅ Username Validator
- ✅ Password Validator
- ✅ Confirm Password Validator
- ✅ Number Validator
- ✅ Pattern Validator
- ✅ Minimum Length Validator
- ✅ Maximum Length Validator
- ✅ Combine Multiple Validators
- ✅ Custom Error Messages
- ✅ Fully Null-safe
- ✅ Lightweight & Fast
- ✅ Easy to Use
- ✅ Reusable Across Projects
📱 Preview #
[assets/preview.png]
🎬 Demo #
[Validator Kit Demo]
---📦 Installation #
Add the package to your pubspec.yaml
dependencies:
validator_kit: ^0.0.1
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()
URL #
ValidatorKit.url()
Username #
ValidatorKit.username()
Password #
ValidatorKit.password()
Confirm Password #
ValidatorKit.confirmPassword(
() => passwordController.text,
)
Number #
ValidatorKit.number()
Pattern #
ValidatorKit.pattern(
RegExp(r'^[A-Z]{3}[0-9]{4}$'),
message: 'Invalid Employee ID',
)
Minimum Length #
ValidatorKit.minLength(8)
Maximum Length #
ValidatorKit.maxLength(30)
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? #
- Clean API
- Highly reusable
- Easy to combine validators
- Supports custom error messages
- Null-safe
- Lightweight
- Production ready
- Perfect for Flutter Forms
🛣️ Roadmap #
Upcoming features
- 🌍 Localization Support
- 📅 Date Validator
- 💳 Credit Card Validator
- 🌐 IPv4 & IPv6 Validator
- 🆔 IBAN Validator
- 🏳 Country-specific Phone Validation
- ⏳ Async Validators
- 🔥 Custom Validator Builder
- 📝 File Validator
- 📦 OTP Validator
🤝 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: https://github.com/Dev-SohelRana
- 💼 LinkedIn: https://www.linkedin.com/in/mdsohelrana201/
- 🌐 Portfolio: https://dev-sohelrana.github.io/sohelrana-portfolio/
📄 License #
This project is licensed under the MIT License.