platform/example/main.dart
2019-08-11 14:48:11 -04:00

27 lines
538 B
Dart

import 'package:angel_validate/angel_validate.dart';
main() {
var bio = new Validator({
'age*': [isInt, greaterThanOrEqualTo(0)],
'birthYear*': isInt,
'countryOfOrigin': isString
});
var book = new Validator({
'title*': isString,
'year*': [
isNum,
(year) {
return year <= new DateTime.now().year;
}
]
});
// ignore: unused_local_variable
var author = new Validator({
'bio*': bio,
'books*': [isList, everyElement(book)]
}, defaultValues: {
'books': []
});
}