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

Simple Form Validations is a Dart package that provides a collection of validators for common data validation scenarios.

simple_form_validations #

Simple Validations is a Dart package that provides a collection of validators for common data validation scenarios. It simplifies the process of validating user input in forms, making it easy to ensure that data entered by users meets specific criteria.

Usage #

To use this plugin, add simple_form_validations as a dependency in your pubspec.yaml file.

Example #

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    final formKey = GlobalKey<FormState>();

    return Scaffold(
      body: SafeArea(
        child: Container(
          padding: const EdgeInsetsDirectional.all(22),
          child: Form(
            key: formKey,
            child: Column(
              children: [
                TextFormField(
                  validator: (value) =>
                      SimpleValidations.usernameOrEmailValidator(value),
                  decoration: const InputDecoration(
                    hintText: 'Validator Demo',
                    enabledBorder: OutlineInputBorder(),
                    focusedBorder: OutlineInputBorder(),
                    border: OutlineInputBorder(),
                  ),
                ),
                const SizedBox(height: 22),
                TextFormField(
                  validator: (value) =>
                      SimpleValidations.passwordValidator(value),
                  decoration: const InputDecoration(
                    hintText: 'Strong Password Validator Demo',
                    enabledBorder: OutlineInputBorder(),
                    focusedBorder: OutlineInputBorder(),
                    border: OutlineInputBorder(),
                  ),
                ),
                const SizedBox(height: 22),
                ElevatedButton(
                  onPressed: () {
                    if (formKey.currentState!.validate()) {
                      print("Valid data!");
                    }
                  },
                  child: const Text('Submit'),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

Available Validators #

The following validators are available in the package:

  • emptyFieldValidator
  • bankIfscValidator
  • alphaCharactersValidator
  • alphaCharactersWithSpaceValidator
  • alphaNumericCharactersValidator
  • alphaNumericCharactersWithSpaceValidator
  • numericValidator
  • numericWithSpaceValidator
  • passportValidator
  • panCardValidator
  • aadhaarValidator
  • vidValidator
  • voterIdValidator
  • socialSecurityValidator
  • emailValidator
  • phoneNumberValidator
  • urlValidator
  • decimalValidator
  • passwordValidator
  • usernameValidator
  • fileExtensionValidator
  • ipAddressValidator
  • hexColorValidator
  • creditCardValidator
  • jsonValidator
  • uuidValidator
  • isbnValidator
  • currencyValidator
  • macAddressValidator
  • htmlTagValidator
  • imeiValidator
  • ageValidator
  • postalCodeValidator
  • bankAccountNumberValidator
  • nameValidator
  • usernameOrEmailValidator
  • isbn13Validator
  • imei15Validator
  • uuidV4Validator
  • postalAddressValidator
  • cvvValidator
  • ipv6Validator
  • latitudeValidator
  • longitudeValidator
  • usernameOrDisplayNameValidator
  • emojiValidator
  • slugValidator

Issues and Feedback #

Please feel free to report any issues or bugs you encounter. Your feedback and suggestions are highly appreciated and will help to improve this package.

5
likes
160
points
29
downloads

Publisher

verified publisherhozefakhety.in

Weekly Downloads

Simple Form Validations is a Dart package that provides a collection of validators for common data validation scenarios.

Repository (GitHub)
View/report issues

Topics

#textfield #validations #form

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on simple_form_validations