isIn method

bool isIn(
  1. dynamic items
)

Checks if the current object is present in the given list, map or string. Returns true if the current object is not null and is present in the list, otherwise returns false.

Implementation

bool isIn(dynamic items) {
  if (items == null) return false;
  if (items is Iterable) {
    return this != null && items.contains(this);
  }
  if (items is Map) {
    return this != null && items.containsValue(this);
  }
  if (items is String) {
    return this != null && items.contains(toString());
  }
  return false;
}