isTypeOrNull<T> function
Returns a Validator that checks if the given value is the correct type
Implementation
Validator isTypeOrNull<T>() {
return (value) => Result(
isValid: value is T || value == null,
expected: '${T.toString()} or null',
value: value,
);
}