All Blogs
Mastering Kotlin Coroutines
Kotlin Coroutines help us run long tasks, like a network call, in the background without blocking the main thread, using simple code that reads from top to bottom.
Callback to Coroutines in Kotlin
We can convert any Callback to Coroutines in Kotlin by wrapping it inside suspendCoroutine or suspendCancellableCoroutine, and resuming with the result.
Retry Operator in Kotlin Flow
The Retry Operator in Kotlin Flow (retry and retryWhen) retries a failed flow based on a condition. We can also use it with exponential backoff delay.
Pagination In RecyclerView Using RxJava Operators
We can implement pagination in RecyclerView using RxJava operators like PublishProcessor, concatMap, and onBackpressureDrop, to load more data as we scroll.
RxJava Operator Map vs FlatMap
In RxJava, Map transforms each item emitted by an Observable by applying a function, whereas FlatMap transforms each item into an Observable.
RxJava Merge Operator
The Merge operator of RxJava combines multiple Observables into one by merging their emissions. Unlike Concat, it does not maintain the order.
Long-running tasks in parallel with Kotlin Flow
We can run long-running tasks in parallel with Kotlin Flow using the zip operator, which runs both tasks together and combines their results.
Retrofit with Kotlin Coroutines
To use Retrofit with Kotlin Coroutines, we mark the API functions with suspend and call them from a coroutine inside the ViewModel. We will build it with MVVM.
coroutineScope vs supervisorScope
A coroutineScope cancels all its children when any one child fails, whereas a supervisorScope does not cancel the other children when one of them fails.