mapFirstOrNull<C> method

C? mapFirstOrNull<C>(
  1. C? predicateAndMap(
    1. E
    )
)

Returns first non-null result of predicateAndMap or null if there is no non-null results for any item in this iterable.

Implementation

C? mapFirstOrNull<C>(C? Function(E) predicateAndMap) {
  for (final item in this) {
    final mapped = predicateAndMap(item);
    if (mapped != null) {
      return mapped;
    }
  }
  return null;
}