smart_form_validator_plus 1.0.1 copy "smart_form_validator_plus: ^1.0.1" to clipboard
smart_form_validator_plus: ^1.0.1 copied to clipboard

Powerful, easy-to-use Flutter package for validating form fields with built-in and custom rules. International-ready, with English as default and full i18n/custom message support.

smart_form_validator_plus #

A powerful, easy-to-use Flutter package for validating form fields with built-in and custom rules. International-ready, with English as default and full i18n/custom message support.

Features #

  • Built-in validators: Email, Phone (international/E.164), Password strength, ID/Passport (customizable), Required
  • Custom rule support with simple syntax
  • Default error messages in English
  • Easy to override/customize error messages (i18n ready)
  • Easy integration with TextFormField/TextField
  • Clean, extensible codebase

Usage #

import 'package:smart_form_validator_plus/smart_form_validator.dart';

TextFormField(
  validator: Validator.email,
)

TextFormField(
  validator: (value) => Validator.password(value, strict: true),
)

TextFormField(
  validator: (value) => Validator.phone(value), // International phone
)

TextFormField(
  validator: (value) => Validator.id(value, pattern: RegExp(r'^[A-Z0-9]{6,20}')), // Custom ID/Passport
)

// Custom rule
TextFormField(
  validator: Validator.custom((value, {locale}) {
    if (value != 'flutter') {
      return 'Must be flutter';
    }
    return null;
  }),
)

Internationalization (i18n) #

  • Default: English
  • You can override all error messages globally:
ValidatorMessages.setCustomProvider((key, value, locale) {
  if (key == 'email') return 'Địa chỉ email không hợp lệ'; // Vietnamese example
  // ...other keys
  return 'Lỗi không xác định';
});
  • Or use any i18n solution (intl, easy_localization, etc.)

Example #

See /example for a full demo app.

Test #

Run all tests:

flutter test

License #

Perpetual, unlimited use granted

Author: Nguyen Thanh Bien
Email: mortarcloud@gmail.com
Website: https://algonest.io.vn

7
likes
130
points
249k
downloads

Publisher

unverified uploader

Weekly Downloads

Powerful, easy-to-use Flutter package for validating form fields with built-in and custom rules. International-ready, with English as default and full i18n/custom message support.

Homepage

Documentation

API reference

License

unknown (license)

More

Packages that depend on smart_form_validator_plus