Created
June 19, 2019 12:30
-
-
Save bettdouglas/838ee0e61938f7ed57eb258412b49837 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_validator.ruleFor('name', ()=>text) | |
..notEmpty() | |
..withMessage('Please enter a name') | |
..length(2, 30) | |
..withMessage('Please enter a reasonable name'); | |
_validator.ruleFor('email', ()=>text) | |
..notEmpty() | |
..withMessage('Email cannot be empty') | |
..emailAddress() | |
..withMessage('Enter a valid email'); | |
_validator.ruleFor('text', ()=>text) | |
..notEmpty() | |
..withMessage('Cannot be empty'); | |
_validator.ruleFor('phone', ()=>text) | |
..notEmpty() | |
..withMessage('Phone number cannot be empty') | |
..matches('[0-9]{0,14}\$') | |
..withMessage('Phone number doesn\'t seem correct'); | |
_validator.ruleFor('int', ()=>text) | |
..matches('(?<=\\s|^)[-+]?\\d+(?=\\s|\$)') | |
..withMessage('Enter a valid number'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment