parse method
Parses value and returns the result, or throws a VException on
failure.
final name = V.string().min(2).parse('Jo'); // 'Jo'
V.string().min(5).parse('Jo'); // throws VException
Implementation
T? parse(Object? value) {
if (hasAsync) {
throw const VAsyncRequiredException(
methodName: 'parse',
suggestion: 'parseAsync',
);
}
final result = safeParse(value);
if (result case VFailure(:final errors)) {
throw VException(errors);
}
return (result as VSuccess<T?>).value;
}