validate method

  1. @override
String? validate(
  1. List<CheckboxOption>? data
)
override

Implementation

@override
String? validate(List<CheckboxOption>? data) {
  if (data != null) {
    if (minOptions != null && data.length < minOptions!) {
      return 'Not enough options selected!';
    } else if (maxOptions != null && data.length > maxOptions!) {
      return 'More than the allowed number of options selected!';
    }
  }

  return null;
}