onValidate method

  1. @override
String? onValidate(
  1. String entityName,
  2. T? value
)
override

Returns the validation message by the child class extending Rule.

Override it in the child class to define the validation logic for it.

Implementation

@override
String? onValidate(String entityName, T? value) {
  if (value == null ||
      isEmptyIterable(value) ||
      isEmptyMap(value) ||
      isEmptyString(value)) {
    return ':entity is required.';
  }
  return null;
}