dto_validator 1.0.0 copy "dto_validator: ^1.0.0" to clipboard
dto_validator: ^1.0.0 copied to clipboard

Dart 1 only

Validator of dto

dto_validator #

A library for Dart backend developers.

Created from templates made available by Stagehand under a BSD-style license.

Usage #

A simple usage example:

import 'package:validator/validator.dart';

class User {
  @Rules(min: 5)
  String email;

  @Rules(required: true, min: 5)
  int id;

  @Rules(required: true)
  String phone;
}

void main() async {
  var validator = new Validator();
  var user = new User()
  ..email = 'email@gmail.com'
    ..id = 2
    ..phone = '123123';
    
    var errors = await validator.validate(user);
    // {User.id: Cannot be less than 5}
    print(errors);
}

For more examples see -

/examples

Tests #

Run in console(from root directory)

pub run test .

0
likes
20
pub points
0%
popularity

Publisher

unverified uploader

Validator of dto

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

More

Packages that depend on dto_validator