# Context Receivers in Kotlin: An Example

DevFeed: [Context Receivers in Kotlin: An Example](<https://devfeed.tech/articles/context-receivers-in-kotlin-an-example-25676.md>)

Original publisher: [Read original article](<https://blog.sanskar10100.dev/context-receivers-in-kotlin-an-example>)

Author: Sanskar Agrawal

Published: 2023-02-26T16:21:57Z

Content type: tutorial

Language: en

Sources: [Sanskar's Stuff](<https://devfeed.tech/sources/sanskar-s-stuff.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [coding](<https://devfeed.tech/topics/coding.md>), [ui](<https://devfeed.tech/topics/ui.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [code](<https://devfeed.tech/tags/code.md>), [coding](<https://devfeed.tech/tags/coding.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-flow](<https://devfeed.tech/tags/kotlin-flow.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [stateflow](<https://devfeed.tech/tags/stateflow.md>), [ui](<https://devfeed.tech/tags/ui.md>)

## AI overview

This tutorial introduces Kotlin context receivers, a feature added in Kotlin 1.6.20, and explains their use through comparison with extension functions. It focuses on simplifying code that combines a StateFlow receiver with lifecycle-related context when collecting reactive UI state. The supplied text ends before the example is complete.

## Source excerpt

Context Receivers are a new feature introduced in Kotlin 1.6.20. They're useful for receiving the context from the call-site when a function is called. To understand it and its utility, let's first take a look at a similar feature available in the la...