I am developing an application aimed at helping school students. Therefore, I do not understand which database to use. The main language is Kotlin. I will use it as Kotlin Multi platform to develop an application for two operating systems(IOS and Android) at once.
-
1This question is asking for opinions and there would be no way for us to even start to make a suggestion without understanding the entire use case. More importantly, Firebase and Realm are totally different; Firebase is an Online First database and Realm is an Offline First database, so there is no direct comparison. There's an accepted answer based on an opinion which really has NOTHING to do with your question. – Jay Dec 08 '21 at 17:59
-
1Please unaccept my answer so i can delete it – Montresor Dec 09 '21 at 06:56
1 Answers
SQLDelight library is the easiest. It generates type-safe Kotlin APIs from SQL statements for various relational databases. SQLDelight also provides a multiplatform implementation of the SQLite driver.
To connect the SQLDelight plugin to a project, apply the SQLDelight Gradle
plugin in your project’s build script (root build.gradle
or build.gradle.kts
):
quoted from kotlin
First, add the plugin's classpath to the build system.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.squareup.sqldelight:gradle-plugin:$sql_delight_version")
}
}
Copied!
Instead of
$sql_delight_version
, use the version you need for your project.Then apply the SQLDelight Gradle plugin by adding this line at the beginning of the build script (
build.gradle
orbuild.gradle.kts
) in your shared multiplatform module
https://kotlinlang.org/docs/kmm-configure-sqldelight-for-data-storage.html#gradle-plugin

- 806
- 6
- 22
-
This answer has nothing to do with the question **"better for multiplatform developing? Firebase or Realm?"** - additionally, this is a library, not a full back end database with full support for authentication, real-time events etc. Most importantly, how could you make a database recommendation without fully understanding the use case? Wouldn't it be more informative to ask the OP what they are using the database for before posting an opinion? – Jay Dec 08 '21 at 18:01