title: Complete kotlin flow successfully and emit partially data on some condition
body: <p>I'm struggling to get completed flow with some result without any exception on some condition. Let's say I'm receiving flow of lists. I want to emit some of its data and then complete without any exception, for example:</p>
  <pre><code>class FlowTest {
  
      @Test
      internal fun `should emit partially when some condition fulfilled`() = runTest {
          val testFlow = flowOf(listOf(1,2), listOf(3,4), listOf(5,6))
              .transform {
                  if(it.contains(4)) {
                      emit(it[0])
                      cancel()
                  } else {
                      emit(it[0])
                      emit(it[1])
                  }
              }
  
          assertEquals(3, testFlow.toList().size, &quot;Should contain [1,2,3]&quot;)
      }
  }
  </code></pre>
  <p>It fails because of <code>JobCancellationException</code>. I could also make some filter and emit specific things, but then <code>listOf(5,6)</code> would also go through filters and this is bad since I'd like to close flow as early as some condition is fulfilled.</p>