exists method
Returns true if the item exists in the iterable, otherwise returns false.
Implementation
bool exists(T item, {EqualityChecker<T>? equalityChecker}) {
return any((T oldItem) {
if (equalityChecker != null) {
return equalityChecker(item, oldItem);
}
if (oldItem == item) return true;
final bool hashCodeEquals = oldItem.hashCode == item.hashCode;
final bool runtimeTypeEquals = oldItem.runtimeType == item.runtimeType;
return hashCodeEquals && runtimeTypeEquals;
});
}