zeba_academy_validator

pub package License: GPL v3 ![Flutter](https://img.shields.io/badge/Flutter-Compatible-blue.svg) ![Dart](https://img.shields.io/badge/Dart-3.x-blue.svg)

A lightweight, powerful, and production-ready Flutter validation package providing commonly used validators for forms and user input.

Designed for Flutter developers who want clean, reusable, and customizable validation logic with zero external dependencies.


✨ Features

  • ✅ Email Validation
  • ✅ Phone Number Validation
  • ✅ Required Field Validation
  • ✅ Password Strength Checker
  • ✅ Minimum Length Validation
  • ✅ Maximum Length Validation
  • ✅ Username Validation
  • ✅ Number Validation
  • ✅ URL Validation
  • ✅ Match Validation (Confirm Password)
  • ✅ Regular Expression Validation
  • ✅ Custom Rule Builder
  • ✅ Multiple Validator Chaining
  • ✅ Null Safety
  • ✅ Zero Dependencies
  • ✅ Easy Integration
  • ✅ Production Ready

🚀 Installation

Add the package to your pubspec.yaml

dependencies:
  zeba_academy_validator: ^1.0.0

Then run

flutter pub get

📦 Import

import 'package:zeba_academy_validator/zeba_academy_validator.dart';

Email Validation

TextFormField(
  validator: Validator.email,
)

Phone Validation

TextFormField(
  validator: Validator.phone,
)

Required Field

TextFormField(
  validator: Validator.required,
)

Minimum Length

TextFormField(
  validator: (value) => Validator.minLength(value, 8),
)

Maximum Length

TextFormField(
  validator: (value) => Validator.maxLength(value, 20),
)

Username Validation

TextFormField(
  validator: Validator.username,
)

Number Validation

TextFormField(
  validator: Validator.number,
)

URL Validation

TextFormField(
  validator: Validator.url,
)

Confirm Password

TextFormField(
  validator: (value) =>
      Validator.match(value, passwordController.text),
)

Regular Expression Validation

Validator.regex(
  value,
  RegExp(r'^[A-Z]{3}[0-9]{3}$'),
);

Password Strength

final strength =
    Validator.passwordStrength("Admin@123");

print(strength);

Output

PasswordStrength.veryStrong

Validator Builder

final validator = ValidatorBuilder()
    .add(Rules.required())
    .add(Rules.email());

final result = validator.validate(email);

Custom Validation Rule

final validator = ValidatorBuilder()

    .add(Rules.required())

    .add((value) {

      if (value != "Flutter") {
        return "Only Flutter allowed";
      }

      return null;
    });

Registration Form Example

Form(
  child: Column(
    children: [

      TextFormField(
        validator: Validator.email,
      ),

      TextFormField(
        validator: Validator.phone,
      ),

      TextFormField(
        validator: (value) =>
            Validator.minLength(value, 8),
      ),

      TextFormField(
        validator: Validator.required,
      ),

    ],
  ),
)

Included Validators

Validator Description
required Required field validation
email Email validation
phone Phone number validation
username Username validation
number Numeric validation
url URL validation
minLength Minimum character validation
maxLength Maximum character validation
regex Custom regex validation
match Confirm password validation
passwordStrength Password strength evaluation

Why zeba_academy_validator?

  • Lightweight
  • Fast
  • Zero Dependencies
  • Easy API
  • Highly Customizable
  • Null Safe
  • Clean Architecture
  • Production Ready
  • Flutter Friendly

Roadmap

Upcoming features include:

  • Aadhaar Validation
  • PAN Validation
  • GST Validation
  • IFSC Validation
  • UPI Validation
  • PIN Code Validation
  • Credit Card Validation
  • Date Validation
  • Age Validation
  • File Validation
  • Localization
  • String Extension Methods
  • More Built-in Validators

Contributing

Contributions are welcome!

If you'd like to improve this package:

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push your branch
  5. Open a Pull Request

Bug reports, feature requests, and suggestions are always appreciated.


License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0).

See the LICENSE file for details.


About Me

✨ I’m Sufyan bin Uzayr, an open-source developer passionate about building and sharing meaningful projects.

You can learn more about me and my work at sufyanism.com or connect with me on LinkedIn.


Your all-in-one learning hub!

🚀 Explore courses and resources in coding, tech, and development at zeba.academy and code.zeba.academy.

Empower yourself with practical skills through curated tutorials, real-world projects, and hands-on experience. Level up your tech game today! 💻✨

Zeba Academy is a learning platform dedicated to coding, technology, and development.

➡ Visit our main site: https://zeba.academy

➡ Explore hands-on courses and resources: https://code.zeba.academy

➡ YouTube: https://www.youtube.com/@zeba.academy

➡ Instagram: https://www.instagram.com/zeba.academy/


⭐ Support

If you find this package useful, please give it a ⭐ on GitHub and like it on pub.dev.

Your support helps us continue building high-quality open-source Flutter packages.


Made with ❤️ by Zeba Academy