errors<ErrorType> method

List<ErrorType> errors<ErrorType>(
  1. S subject
)

Runs the validator and returns a list of errors

When supplied a type parameter the error list will be filtered to all errors that have the given type. This is handy when just error information is required.

Implementation

List<ErrorType> errors<ErrorType>(S subject) {
  return this(subject).leftMap((errors) {
    final Iterable<ErrorType> filtered = errors.whereType();
    return filtered.toList();
  }).fold((l) => l, (r) => const []);
}