enterprise_validator 0.0.1
enterprise_validator: ^0.0.1 copied to clipboard
A package which have built in injectable validations, and enables you to create your own.
This package aims to simplify the process of injecting validation rules, to your form fields, taking the single responsibility from SOLID Design pattern, Each class of validation represents a validation rule, which can be applied to your inputs. also you can implement your own validation rules.
Features #
- Provide about 14 built-in validations
- Strings
- Validating email
- Validating json
- Validating required
- Validating length (Min, Max, Exact)
- Validating Mobile Phones (Egyptian, Saudi)
- Numbers
- Validating Equal to
- Validating Not Equal to
- Validating Not Equal to Zero
- Validating Range Of
- Strings
Getting started #
import 'package:enterprise_validator/enterprise_validator.dart'
Usage #
// Orders of validation matters, the first rule you add, the first validation fires.
Column(
children: [
FormField(
validator: (value)=> [
IsRequiredRule('Validation Error Message'),
IsEmailOrMobileRule('Validation Error Message')
].getValidationErrorMessage(value),
),
FormField(
validator: (value)=> [
IsValidRequiredRule('Validation Error Message'),
IsMinimumLengthRule('Validation Error Message', minimum: 15)
].getValidationErrorMessage(value),
),
),
],
);