Contains()
Whether the collection contains an element equal to element.
This operation will check each element in order for being equal to element, unless it has a more efficient way to find an element equal to element. Stops iterating on the first equal element.
Example
void main() {
Iterable<int> numbers = [1, 2, 3, 4, 5];
// Check if the list contains the number 3
if (numbers.contains(3)) {
print('Number 3 is in the list.');
} else {
print('Number 3 is not in the list.');
}
}
Output
Number 3 is in the list.
Exited.