allCollectLimited<T, E> static method

Formix<T, E> allCollectLimited<T, E>(
  1. List<Formix<T, E>> validators, {
  2. int maxErrors = 5,
})

Creates a validator that requires ALL rules to pass, collecting up to maxErrors errors.

Similar to allCollect, but stops collecting errors once the limit is reached. This improves performance when you only need to show a limited number of errors.

final validator = Validate.allCollectLimited<String, String>(
  [rule1, rule2, rule3, rule4, rule5],
  maxErrors: 3, // Stop after 3 errors
);

Implementation

static Formix<T, E> allCollectLimited<T, E>(
  List<Formix<T, E>> validators, {
  int maxErrors = 5,
}) =>
    AllOfCollectLimited(validators, maxErrors: maxErrors);