GroupRule constructor

GroupRule(
  1. List<Rule?> rulesList, {
  2. required String name,
  3. bool? requiredAll,
  4. int? requiredAtleast,
  5. int? maxAllowed,
  6. String? customErrorText,
  7. Map<String, String>? customErrors,
})

Implementation

GroupRule(
  this.rulesList, {
  required this.name,
  this.requiredAll,
  this.requiredAtleast,
  this.maxAllowed,
  this.customErrorText,
  this.customErrors,
}) {
  if (isNullOrEmpty(name)) {
    throw "Group Rule => \n'name' parameter is required";
  }

  if (isNotNull(requiredAtleast) && rulesList.length < requiredAtleast!) {
    throw "Group Rule => \nA minimum of 'requiredAtleast' number of ($requiredAtleast) rules are required";
  }

  _run();
}