validated method

T? validated(
  1. S subject
)

Returns the validated and transformed subject If validation of subject fails returns null

Implementation

T? validated(S subject) {
  return this(subject).fold(
    (errors) {
      return null;
    },
    (s) => s,
  );
}