anyMatch function

bool anyMatch(
  1. String? subject,
  2. List<String> potentials, {
  3. bool caseSensitive = true,
})

Implementation

bool anyMatch(String? subject, List<String> potentials,
    {bool caseSensitive = true}) {
  if (subject == null) return false;
  if (caseSensitive != true) {
    subject = subject.toLowerCase();
  }
  for (var p in potentials) {
    if (caseSensitive != true) {
      p = p.toLowerCase();
    }

    if (p == subject) return true;
  }
  return false;
}