bandicoot 0.0.5 copy "bandicoot: ^0.0.5" to clipboard
bandicoot: ^0.0.5 copied to clipboard

outdated

Simple validation library for the backend or the frontend.

Bandicoot #

A simple validation library + API for Dart.

Currently a work in progress.

Example Usage #

PasswordRules passwordRules = PasswordRules();

Bandicoot RegisterUserValidator = Bandicoot()
  ..property(
    name:'firstName',
    validators: [IsString()]
  )
  ..property(
    name:'lastName',
    validators: [IsString()]
  )
  ..property(
    name: 'emailAddress',
    validators: [IsEmail()]
  )
  ..property(
    name: 'confirmEmailAddress',
    validators: [MatchesProperty('emailAddress')]
  )
  ..property(
    name: 'password',
    validators: [IsPassword(passwordRules)]
  )
  ..property(
    name:'confirmPassword',
    validators: [MatchesProperty('password')]
  );

void main() {
  Map registerData = {
    'emailAddress': ;
    'confirmEmailAddress': 'example@gmail.com';
    'password': 'insecure';
    'confirmPassword': 'not the same';
  }

  List<String> errors = RegisterUserValidator.validate(registerData);

  if (errors.length > 0) {
    // Errors have been returned
  } else {
    // Error free!
  }
}
2
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Simple validation library for the backend or the frontend.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on bandicoot