isIn function

bool? isIn(
  1. String? str,
  2. dynamic values
)

check if the string is in a array of allowed values

Implementation

bool? isIn(String? str, values) {
  if (values == null || values.length == 0) {
    return false;
  }

  if (values is List) {
    values = values.map((e) => e.toString()).toList();
  }

  return values.indexOf(str) >= 0 == true;
}