Skip to content

alfredoUcar/dart-multi-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chain multiple validators and run together as one.

Usage

Declaring validators in constructor

var customValidator = MultiValidator<int>([
    firstValidator,
    secondValidator,
    // ...aditional validators
  ]);

Adding with addValidator method

var customValidator = MultiValidator<int>();
customValidator.addValidator(firstValidator);
customValidator.addValidator(secondValidator);

Additional information

A simple validator is a function that receives the value to be validated and outputs the message error if any or null.

All validators must expect the same input type.

Note that validators are applied in the order they are declared or added and stops at first failing validator.

Releases

No releases published

Packages

No packages published

Languages