transform<T> function
- T fn(
- dynamic
- IValidator child
Transforms a value using a provided function.
The fn
function is applied to the input value, and the result is then
passed to the child
validator. This is a low-level building block for
creating custom transformers.
Implementation
IValidator transform<T>(T Function(dynamic) fn, IValidator child) {
return Validator((value) {
return child.validate(fn(value));
});
}