All Blogs
Unit Testing ViewModel with Kotlin Flow and StateFlow
To unit test a ViewModel with Kotlin Flow and StateFlow, we mock the data layer, use a test dispatcher, and verify the StateFlow values using Turbine.
How does the Kotlin Multiplatform work?
In Kotlin Multiplatform, we write shared code once in Kotlin. It becomes Java bytecode for Android and native code inside a framework for iOS.
RxJava Subject - Publish, Replay, Behavior, and Async
A Subject in RxJava acts as both an Observer and an Observable. Publish, Replay, Behavior, and Async Subjects differ in which items a new subscriber gets.
OkHttp Interceptor
OkHttp Interceptors are a mechanism that can monitor, rewrite, and retry API calls. We use them for logging, caching, adding headers, and refreshing tokens.
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.