validation method

dynamic validation(
  1. dynamic inspectionCase,
  2. dynamic inspectionCaseRule, {
  3. dynamic myCustomRule(
    1. String,
    2. InspectionCase inspectionCase
    )?,
})
inherited

Implementation

validation(inspectionCase, inspectionCaseRule,
    {Function(String, InspectionCase inspectionCase)? myCustomRule}) {
  inspectionCase.rule = inspectionCaseRule;
  List rule = inspectionCaseRule.split(':');
  String ruleString = rule[0];
  if (myCustomRule != null) {
    String customRulesOutput = myCustomRule(ruleString, inspectionCase);
    if (customRulesOutput != null && customRulesOutput != '')
      return customRulesOutput;
    else
      return checkRule(ruleString, inspectionCase);
  } else
    return checkRule(ruleString, inspectionCase);
}