<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>callbacks on Carrion.dev</title><link>https://carrion.dev/en/tags/callbacks/</link><description>Recent content in callbacks on Carrion.dev</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>ignacio@carrion.dev (Ignacio Carrión)</managingEditor><webMaster>ignacio@carrion.dev (Ignacio Carrión)</webMaster><copyright>&amp;copy;{year}, All Rights Reserved</copyright><lastBuildDate>Tue, 11 Mar 2025 08:00:00 +0100</lastBuildDate><atom:link href="https://carrion.dev/en/tags/callbacks/index.xml" rel="self" type="application/rss+xml"/><item><title>Converting Callbacks to Coroutines and Flows in Kotlin</title><link>https://carrion.dev/en/posts/callback-to-flow-conversion/</link><pubDate>Tue, 11 Mar 2025 08:00:00 +0100</pubDate><author>ignacio@carrion.dev (Ignacio Carrión)</author><atom:modified>Tue, 11 Mar 2025 08:00:00 +0100</atom:modified><guid>https://carrion.dev/en/posts/callback-to-flow-conversion/</guid><description>Converting Callbacks to Coroutines and Flows in Kotlin Callback-based APIs have been a common pattern in asynchronous programming for many years. However, with Kotlin&amp;rsquo;s coroutines and flows, we can transform these callbacks into more modern, sequential code that&amp;rsquo;s easier to read and maintain. In this article, we&amp;rsquo;ll explore how to use suspendCoroutine and callbackFlow to convert callback-based APIs into coroutines and flows.
Understanding suspendCoroutine The suspendCoroutine function is a powerful tool that allows you to wrap callback-based APIs into suspend functions.</description><dc:creator>Ignacio Carrión</dc:creator><media:content url="https://carrion.dev/images/kotlin/suspend-coroutine.png" medium="image"><media:title type="html">featured image</media:title></media:content><category>kotlin</category><category>coroutines</category><category>flows</category><category>callbacks</category></item></channel></rss>