flrx_validator 0.3.0 copy "flrx_validator: ^0.3.0" to clipboard
flrx_validator: ^0.3.0 copied to clipboard

outdated

A powerful, extensible validator package to get validation messages based on a list of rules.

Flrx Validator #

It is a fluent API based FormField validator for flutter, that promotes code reuse. It is highly extensible, modular and testable.

Pub Build Status codecov GitHub

Installation #

Add the following to your pubspec.yaml file

dependencies:
  flrx_validator: ^0.3.0

Usage #

Documentation #

For more info on Flrx Validator and Rules you can see the documentation.

Built In Rules #

Rule Arguments Description
AnyRule ruleList Takes A list of rules, Passes when any of the rule passes, Useful for Validation of Username/Email Fields or similar fields
EmailRule - Passes when String is an E-Mail
InRule acceptedList Passes when the value is included in the given list of values.
MaxLengthRule maxLength Passes when the String length is less than the given length
MinLengthRule minLength Passes when the String length is more than the given length
NotInRule rejectedList Passes when the value is not included in the given list of values.
RegexRule regex Passes when the value matches the given Regex.
RequiredRule - Passes when the value is not null or empty.

Can't see a rule you need? Raise an issue or create a Pull Request.

Example #

import 'package:flrx_validator/validator.dart';
import 'package:flrx_validator/rules/email_rule.dart';
import 'package:flrx_validator/rules/required_rule.dart';

....
....

TextFormField(
    validator: Validator<String>()
        .add(RequiredRule())
        .add(EmailRule())
        .build()
);

....
....

Contributing #

Please see CONTRIBUTING.

License #

Please see LICENSE.

5
likes
0
pub points
87%
popularity

Publisher

unverified uploader

A powerful, extensible validator package to get validation messages based on a list of rules.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (LICENSE)

Dependencies

meta

More

Packages that depend on flrx_validator