E singleWhere (bool test(E value), {E orElse()}) inherited
E singleWhere(bool test(E value), {E Function()? orElse}) { late E result; bool foundMatching = false; for (E element in this) { if (test(element)) { if (foundMatching) { throw IterableElementError.tooMany(); } result = element; foundMatching = true; } } if (foundMatching) return result; if (orElse != null) return orElse(); throw IterableElementError.noElement(); }