defaultTo function
- dynamic defaultValue,
- IValidator child
Provides a default value if the input is null.
If the input value is null, it is replaced with defaultValue. Otherwise,
the original value is passed through.
Passes the resulting value to the child validator.
Implementation
IValidator defaultTo(dynamic defaultValue, IValidator child) {
return transform((v) => v ?? defaultValue, child);
}