forbidFields method

JarObject forbidFields(
  1. List<String> fieldNames, [
  2. String? message
])

Implementation

JarObject forbidFields(List<String> fieldNames, [String? message]) {
  return addValidator((value) {
    if (value == null) return null;

    for (final field in fieldNames) {
      if (value.containsKey(field)) {
        return message ?? 'The field $field is not allowed';
      }
    }
    return null;
  });
}