The introduction of coroutines to Kotlin opened the door for several innovations — Kotlin Flow is one of them, directly integrated into the coroutines library. It's an implementation of Reactive Streams on top of coroutines. Unlike RxJava, flows are a native Kotlin API similar to the familiar sequence API with methods that include
filter. Like sequences, flows are cold, meaning that the values of the sequence are only constructed when needed. All of this makes writing multithreaded code much simpler and easier to understand than other approaches. The
toList method, predictably, converts a flow into a list which is a common pattern in tests.