Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shindakioku/dto_validator
https://github.com/shindakioku/dto_validator
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/shindakioku/dto_validator
- Owner: shindakioku
- License: bsd-3-clause
- Created: 2018-03-11T22:49:45.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-11T23:08:27.000Z (almost 7 years ago)
- Last Synced: 2023-08-20T21:49:50.047Z (over 1 year ago)
- Language: Dart
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# dto_validator
A library for Dart backend developers.
Created from templates made available by Stagehand under a BSD-style
[license](https://github.com/dart-lang/stagehand/blob/master/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 protected]'
..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 test .`