call method

  1. @override
String? call(
  1. List? value
)
override

Implementation

@override
String? call(List? value) {
  var min = this.min;
  var max = this.max;
  if (value == null) return null;
  if (min != null && max != null) {
    if (value.length < min || value.length > max) {
      return 'Requires a number of items between $min and $max';
    }
  } else if (min != null) {
    if (value.length < min) {
      return 'Requires at least $min item(s)';
    }
  } else if (max != null) {
    if (value.length > max) {
      return 'Requires a number of items(s) less than or equal to $max';
    }
  }
  return null;
}