isTypeOrNull<T> function

Validator isTypeOrNull<T>()

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,
      );
}