This guide is a short explanation on simplifying the use of Firebase real-time database in Kotlin via Coroutines. As far as you know, for every database operation, there is an associated callback that will notify you about the success or failure of the operation.
What I really don’t love about callbacks is they break the tendency of executing code in a uniform order. With Java, we can use RxJava but it would still add some boilerplate code & makes the code kind of messy to read. With Kotlin, we have Coroutines which executes code asynchronously in a lightweight thread without blocking the UI following a convenient paradigm. …
DevOps, one of the important practices that every developer should follow to extensively optimize their tasks. Clearly, it’s not limited to the topic we are discussing but it’s highly used in the industry.
So you may ask what are those practices? Well, there are a lot of uses cases but one of the common use-case in software development is supposed you are working on a project & a person wants to contribute to your work then how can you verify that his commit does not break the project with your latest commit upon merging. Surely you can verify it manually but it’s highly time-consuming. At this point, you can use some type of automation to automate this process (called CI). …
SQLDelight is a multi-platform library to generate typesafe Kotlin APIs from your SQL statements. It has its special schema file (.sq) where we write the supporting SQL statements which are compile-time safe & its integration with powerful IDE like Android Studio you will get all the benefits like autocomplete, refactoring, etc.
One of my favorite thing about SQLDelight is its support for multiplatform. Anyway, this is not a typical guide on how to use the library their official docs are way better in terms of it.
Well, I am going to talk about a specific thing that is types. As we know custom column types for SQLite is always a crucial thing because they are not built-in so developers tend to find a technique to map their custom object type to mostly TEXT
which is something SQL understands. …
Room is a powerful library that provides an abstraction over standard SQLite for robust database access. Under the hood, for some part, it uses annotation processing to generate `Dao` & `Entity` classes.
Although the library is very useful there is one thing that I find writing/copy-pasting the same code all the time & that is TypeConverters
Room supports only primitive data types (String, int, etc) so to access a complex (non-primitive) data you need to write a TypeConverter. A Type Converter is a method annotated with @TypeConverter
. It must receive exactly one parameter and have a non-void return type. …
About