# suspend function

Published articles for suspend function.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Coroutine Essentials

DevFeed: [Coroutine Essentials](<https://devfeed.tech/articles/coroutine-essentials-25051.md>)

Original publisher: [Read original article](<https://typealias.com/start/kotlin-coroutines/>)

Author: author@typealias.com (Dave Leeds)

Published: 2026-08-21T00:00:00Z

Content type: tutorial

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

Topics: [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [coding](<https://devfeed.tech/topics/coding.md>), [Software](<https://devfeed.tech/topics/software.md>)

Tags: [async](<https://devfeed.tech/tags/async.md>), [cancellation](<https://devfeed.tech/tags/cancellation.md>), [coding](<https://devfeed.tech/tags/coding.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [coroutine](<https://devfeed.tech/tags/coroutine.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [deferred](<https://devfeed.tech/tags/deferred.md>), [dispatcher](<https://devfeed.tech/tags/dispatcher.md>), [exception-handling](<https://devfeed.tech/tags/exception-handling.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [job](<https://devfeed.tech/tags/job.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [launch](<https://devfeed.tech/tags/launch.md>), [learn-to-program](<https://devfeed.tech/tags/learn-to-program.md>), [parallelism](<https://devfeed.tech/tags/parallelism.md>), [programming](<https://devfeed.tech/tags/programming.md>), [runblocking](<https://devfeed.tech/tags/runblocking.md>), [software](<https://devfeed.tech/tags/software.md>), [structured-concurrency](<https://devfeed.tech/tags/structured-concurrency.md>), [suspend-function](<https://devfeed.tech/tags/suspend-function.md>), [withcontext](<https://devfeed.tech/tags/withcontext.md>), [yield](<https://devfeed.tech/tags/yield.md>)

### AI overview

This tutorial introduces essential Kotlin coroutine concepts for performing multiple tasks concurrently, such as making network calls while updating a screen. It aims to provide a foundation for day-to-day coding and more advanced coroutine concepts.

### Source excerpt

When you're on hold during a phone call, you might also check your email. While brewing coffee, you might also cook breakfast. And while driving a car, you might listen to a podcast. In the same way, sometimes it's helpful for the software that we write to do more than one thing at a time. For example, it could make two or three network calls at one time--all while updating the screen to show the progress of each call.

## Continuation\<R, A\> in Kotlin

DevFeed: [Continuation\<R, A\> in Kotlin](<https://devfeed.tech/articles/continuation-r-a-in-kotlin-25512.md>)

Original publisher: [Read original article](<http://nomisrev.github.io/continuation-monad-in-kotlin/>)

Author: Simon Vergauwen

Published: 2021-11-28T00:00:00Z

Content type: tutorial

Language: en

Sources: [nomisRev](<https://devfeed.tech/sources/nomisrev.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [Functional programming](<https://devfeed.tech/topics/functional-programming.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [continuation](<https://devfeed.tech/tags/continuation.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [effect](<https://devfeed.tech/tags/effect.md>), [either](<https://devfeed.tech/tags/either.md>), [exception](<https://devfeed.tech/tags/exception.md>), [functional-programming](<https://devfeed.tech/tags/functional-programming.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-standard-library](<https://devfeed.tech/tags/kotlin-standard-library.md>), [monad](<https://devfeed.tech/tags/monad.md>), [suspend-function](<https://devfeed.tech/tags/suspend-function.md>), [syntax](<https://devfeed.tech/tags/syntax.md>)

### AI overview

A Kotlin tutorial introduces Continuation Passing Style and typed computations that can represent either a successful result or a typed failure. It develops an Effect type implemented as a suspend function and demonstrates a DSL for validation and file-reading examples.

### Source excerpt

Coroutines is one of the most liked features in Kotlin. Most people are familiar with the KotlinX Coroutines implementation, and many are also familiar with suspendCoroutine from the Kotlin Standard Library and then have also come across Continuation.

## Kotlin property delegates for Datastore Preferences library

DevFeed: [Kotlin property delegates for Datastore Preferences library](<https://devfeed.tech/articles/kotlin-property-delegates-for-datastore-preferences-library-26020.md>)

Original publisher: [Read original article](<https://proandroiddev.com/kotlin-property-delegates-for-datastore-preferences-library-5d4e1cdb609b?source=rss-e93d234beac6------2>)

Author: Yahor Urbanovich

Published: 2021-08-23T15:40:08Z

Content type: tutorial

Language: en

Sources: [Stories by Yahor Urbanovich on Medium](<https://devfeed.tech/sources/stories-by-yahor-urbanovich-on-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Library](<https://devfeed.tech/topics/library.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [kotlin-flow](<https://devfeed.tech/topics/kotlin-flow.md>), [migration](<https://devfeed.tech/topics/migration.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [delegates](<https://devfeed.tech/tags/delegates.md>), [delegation](<https://devfeed.tech/tags/delegation.md>), [deprecated](<https://devfeed.tech/tags/deprecated.md>), [flow](<https://devfeed.tech/tags/flow.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-flow](<https://devfeed.tech/tags/kotlin-flow.md>), [library](<https://devfeed.tech/tags/library.md>), [migration](<https://devfeed.tech/tags/migration.md>), [property-delegation](<https://devfeed.tech/tags/property-delegation.md>), [suspend-function](<https://devfeed.tech/tags/suspend-function.md>)

### AI overview

This tutorial explains migrating preference storage from SharedPreferences to AndroidX DataStore Preferences. It shows how Kotlin property delegation can encapsulate reading and writing values, and how Flow, coroutines, first(), and runBlocking can support single-value access despite DataStore's Flow-based API.

### Source excerpt

Kotlin delegated property for Datastore Preferences library Recently AndroidX Datastore 1.0 was released. The moment has come, it's time to migrate away from SharedPreferences. As for me, the key benefit is the built-in support of Kotlin Flow and Coroutines. Previously we had to write our own wrapper under SharedPreferences.OnSharedPreferenceChangeListener, emit changes into ConflatedBroadcastChannel and then convert it into Flow. https://medium.com/media/b5410ce9df08d9b73427a2138a6b0a8d/href Firstly, this approach produces a lot of intermediate variables. Secondly, ConflatedBroadcastChannel deprecated and should be replaced with StateFlow. In this case, DataStore comes out as the winner. The migrated to DataStore version looks clean and simple. https://medium.com/media/cce0d485e2af9941e677dc7973a54c6f/hrefRead/write single value using SharedPreferences Let's imagine, we need to store the current App theme as String. For this purpose, we need to initialize SharedPreferences, then make two functions to read and write these values. https://medium.com/media/3bc9760a22ebd1071e4dcb21eaf8d4ba/href Well, two functions it is not so bad, but we can try to merge this into single Property. https://medium.com/media/c3babbf2b6c55bb18172f66ddc825b06/href To make it fully clear and supportable we can use the Kotlin delegation feature. As we want to read and write simultaneously, ReadWriteProperty will suit our goal. https://medium.com/media/80f370a5a5735b911c75d3a0f1d22b21/href Please take a look at the final compact version, where all logic is encapsulated inside the delegate. https://medium.com/media/39b5311b04373b1f31d3030b8b083587/hrefDataStore Preferences and missing API During migration, it turned out that the library doesn't provide an API for reading a single property. DataStore proposes to use Flow for all cases. Developers are now required to read/write the value in the scope of a suspend function. https://medium.com/media/e7c4e45e239e11bc5082f3997e5280dd/href What was e

## JUnit Coroutines Runner

DevFeed: [JUnit Coroutines Runner](<https://devfeed.tech/articles/junit-coroutines-runner-38650.md>)

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

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

Content type: tutorial

Language: en

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

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [coroutines](<https://devfeed.tech/tags/coroutines.md>), [junit](<https://devfeed.tech/tags/junit.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-compiler](<https://devfeed.tech/tags/kotlin-compiler.md>), [runner](<https://devfeed.tech/tags/runner.md>), [suspend-function](<https://devfeed.tech/tags/suspend-function.md>), [tests](<https://devfeed.tech/tags/tests.md>)

### AI overview

This tutorial explores how to reduce repeated runBlockingTest setup in Kotlin coroutine tests by creating a custom JUnit rule. It explains the resulting suspend-function and bytecode validation issues and investigates their root cause.

### Source excerpt

Introduction Recently while writing tests for kotlin code with coroutines I found one annoying thing: almost all the tests start with runBlockingTest. Typing the same stuff repeatedly is something we can't accept! So, I decided to think about how to improve this. Disclaimer. Yes, this is an example of how to spend few hours to optimize some task that requires you 2 seconds to complete each time. Even on a scale of hundreds of usages such optimization most likely won't pay your time back. But it is always fun to do some weird things even if you understand that they are stupid.