validate method

Result validate(
  1. dynamic value, {
  2. bool exists = true,
})

Implementation

Result validate(dynamic value, {bool exists = true}) {
  if ((value == null && isNullable && exists) || (value == null && isOptional && !exists)) {
    return Result.valid(value);
  }
  final result = validator(value);
  if (result is Future<Result>) {
    throw AsyncValidatorException();
  }
  return result;
}