All Blogs

Kotlin Flow Zip Operator for Parallel Multiple Network Calls

Kotlin Flow Zip Operator for Parallel Multiple Network Calls

The Kotlin Flow zip operator combines the emissions of two flows into one. We can use it to make multiple network calls in parallel and get both results together.

App Startup Library

App Startup Library

The App Startup Library lets apps and libraries initialize their components at startup through one shared ContentProvider, which improves App Startup time.

Instant Search Using Kotlin Flow Operators

Instant Search Using Kotlin Flow Operators

We can build instant search in Android using Kotlin Flow operators like debounce, filter, distinctUntilChanged, and flatMapLatest, to avoid extra network calls.

Creating Flow Using Flow Builder in Kotlin

Creating Flow Using Flow Builder in Kotlin

In Kotlin, we can create a Flow using four flow builders, which are flowOf(), asFlow(), flow{}, and channelFlow{}. We will learn each one with examples.

Exception Handling in Kotlin Flow

Exception Handling in Kotlin Flow

In Kotlin Flow, we handle exceptions using the catch operator. The flow can complete with or without an exception, and catch lets us handle it gracefully.

Terminal Operators in Kotlin Flow

Terminal Operators in Kotlin Flow

Terminal operators in Kotlin Flow, like collect, are the operators that actually start the flow by connecting the flow builder and operators with the collector.

suspend function in Kotlin Coroutines

suspend function in Kotlin Coroutines

A suspend function in Kotlin Coroutines is a function that can be started, paused, and resumed, without blocking the thread. Let's see how it works.

Kotlin withContext vs Async-await

Kotlin withContext vs Async-await

withContext does not create a new coroutine. It only shifts the context of the current one, whereas async creates a new coroutine and we use await() for the result.

Room Database with Kotlin Coroutines

Room Database with Kotlin Coroutines

To use Room Database with Kotlin Coroutines, we mark the DAO functions with suspend and call them from a coroutine. We will build it with MVVM.