bandicoot 0.0.3 copy "bandicoot: ^0.0.3" to clipboard
bandicoot: ^0.0.3 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 #

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

void main() {
  Map<String, dynamic> registerData = new Map();

  registerData['emailAddress'] = 'example@gmail.com';
  registerData['confirmEmailAddress'] = 'example@gmail.com';
  registerData['password'] = 'insecure';
  registerData['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