Kotlin’s Coroutines allow the use of suspend functions, Channels and Flows and they all operate in the context of a so-called CoroutineScope. How can we tie it to the lifecycle management of our own components?
If you are not at least somewhat familiar with what a
CoroutineScope is, read this article by Roman Elizarov about Structured Concurrency first.
CoroutineScope defines a lifecycle, a lifetime, for Coroutines that are built and launched from it. A
CoroutineScope lifecycle starts as soon as it is created and ends when it is canceled or when it associated
SupervisorJob finishes. …
In my earlier article, we examined how exceptions are handled by Coroutines and Coroutine Scopes that run with a
Job, which is the default way of running them, without any so-called supervision.
Coroutines support Structured Concurrency, in which a parent-Coroutine that runs with a
Job and its child-Coroutines all live and die together:
Our code in Kotlin’s Coroutines may throw exceptions and managing them is not always as straightforward as we may think. Let’s examine the rules and offer some tips on how to deal with them.
We started building our app, we chose Kotlin and we decided to use Coroutines as our main pattern to deal with asynchronous code. No regrets! And this article is not meant to convince us of this, or otherwise.
However… dealing with exceptions is a bit trickier than we expected. I myself tried to figure out some issues I had when dealing with exceptions thrown while
LiveData and ViewModels from the Android Architecture Component library are building blocks of the reactive MVVM (Model-View-ViewModel) and MVI (Model-View-Intent) patterns when showing content in our app’s UI. But what about navigation? There are some issues we’d need to address and this article aims to help us with that.
The problem revolves around the
LiveData component. Whether we use the MVVM or MVI pattern, or some variant of them, our UI is reactive and it observes emitted values from one or more
LiveData properties of a
This is an overview of the functions
with in Kotlin and a guide to how you can use them.
This is not the first — and last — blog post on the Internet about the functions
with. They are part of the Kotlin standard library and developers use them often, and so do the developers in our company. With this blog post, I’ll be adding (yet another) guide on how to use them, and it is based on our experiences here at Intrepid.
Before continuing with the rest, let’s first…
What is symmetrical and asymmetrical encryption and how do browsers use it to protect your data?
When you open your browser and you see the text in the address-bar that begins with
https, where the
s stands for secured, you are sending and receiving information in a secure way. It is encrypted and only you and the website that you visit know what is being said.
Ever wondered how this all works?
There are two main parts to secure and encrypt information going back and forth. The first is a so-called handshake on how both parties should encrypt their data…