must method

PropertyRuleBuilder<T, V> must(
  1. bool predicate(
    1. V value
    ),
  2. String errorMessage
)

Custom predicate validator.

Implementation

PropertyRuleBuilder<T, V> must(
  bool Function(V value) predicate,
  String errorMessage,
) {
  _validators.add((val) {
    if (!predicate(val)) {
      return errorMessage;
    }
    return null;
  });
  return this;
}