# Kotlin flow: Nesting vs Chaining

DevFeed: [Kotlin flow: Nesting vs Chaining](<https://devfeed.tech/articles/kotlin-flow-nesting-vs-chaining-38649.md>)

Original publisher: [Read original article](<https://krossovochkin.com/posts/2021_07_08_kotlin_flow_nesting_vs_chaining/>)

Published: 2021-07-08T00:00:00Z

Content type: tutorial

Language: en

Sources: [Vasya Drobushkov](<https://devfeed.tech/sources/vasya-drobushkov.md>)

Topics: [kotlin-flow](<https://devfeed.tech/topics/kotlin-flow.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Reactive Streams](<https://devfeed.tech/topics/reactive-streams.md>), [reactive](<https://devfeed.tech/topics/reactive.md>), [RxJava](<https://devfeed.tech/topics/rxjava.md>)

Tags: [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-flow](<https://devfeed.tech/tags/kotlin-flow.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [reactive-streams](<https://devfeed.tech/tags/reactive-streams.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>)

## AI overview

A tutorial comparing nesting and chaining in Kotlin Flow reactive streams. It explains that chaining can improve readability for simple sequential streams, while nesting is useful for sharing data across streams and managing stream lifecycles, such as conditionally observing a user's location.

## Source excerpt

Introduction When it comes to reactive streams it is likely everyone heard about huge 'Rx-chains'. But reactive streams are not only about chaining but also about nesting. Let's find out what are they, what are the differences, and why it matters. We'll use Kotlin Flow throughout the article, but everything can be applied to RxJava as well. First of all, we need to come up with definitions. For that, we'll take a look at some simple streams.