firstNotNullOf<R> method
R
firstNotNullOf<R>(
- R? transform(
- T?
Returns the first non-null value after applying the given transform
function, throwing a NoSuchElementException exception if there is no
such value.
Implementation
R firstNotNullOf<R>(R? Function(T?) transform) {
final R? element = firstNotNullOfOrNull(transform);
if (element != null) {
return element;
} else {
throw const NoSuchElementException(
"No element of the collection was transformed to a non-null value.",
);
}
}