firstValueWhere method
Iterates through all values of all sets, and returns the first value
it finds that satisfies test
.
If no element satisfies test
, the result of invoking the orElse
function is returned, or if orElse
is omitted, it defaults to throwing a StateError.
See also: firstValueWhereOrNull
Implementation
V firstValueWhere(bool Function(V) test, {V Function()? orElse}) {
for (ISet<V> values in _mapOfSets.values) {
V? value = values.firstWhereOrNull(test);
if (value != null) return value;
}
if (orElse != null) return orElse();
throw StateError("No element");
}