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

outdated

Simple validation library for the backend or the frontend.

Bandicoot #

A simple validation library + API for Dart.

Example Usage #

import 'package:bandicoot/bandicoot.dart';
import 'package:bandicoot/validators.dart';

class LoginValidator extends Bandicoot {
  String emailAddress;
  String password;

  LoginValidator({this.emailAddress, this.password}) {
    this.setValidators([
      PropertyValidator('emailAddress', validate: [IsEmail()]),
      PropertyValidator('password', validate: [IsPassword()])
    ]);
  }

  @override
  Map toMap() {
    return {emailAddress: this.emailAddress, password: this.password};
  }
}

void main() {
  LoginValidator validator =
      LoginValidator(emailAddress: 'example@gmail.com', password: 'insecure');

  try {
    List<String> errors = validator.validate();
  } catch (e) {
    print(e);
  }
}
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