fluent_validation
C# के लिए फ्लूएंट वैलिडेशन का डार्ट आधारित संस्करण। FluentValidation वस्तुओं को बहुत अधिक बॉयलरप्लेट के बिना आसानी से सत्यापित करने की अनुमति देता है।
C# fluent validation का डार्ट पोर्ट
यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।
This is a port of the C# variant as can be seen at This Link
The goal with this was to decouple the UI validation as seen in Flutters TextFields and use a more common and readable standard. It is still very much beta so please give it a go and give me your feedback.
class UserValidator extends AbstractValidator<User> {
UserValidator() {
ruleFor((user) => user.age, key: 'age').isNotNull().greaterThanOrEqual(13);
ruleFor((user) => user.name, key: 'name').isNotEmpty();
}
}
// Later on
final UserValidator validator = UserValidator();
ValidationResult result = validator.validate(user);
result.errors.first.key == 'The key of the rule that errored (for example age)'
result.errors.first.message == 'The supplied error message (Passed by you, or default)'
result.errors.first.code == 'The error code'
These are not included in the default C# version.
Feel free to do a pull request with any ideas and I will check each one. ¬ Rad