compose multiplatform sqldelight on desktop gets empty list

70 Views Asked by At

I have trouble understanding this situation. Sqldelight on multiplatform works fine in androidMain part of the project and works totally fine but in Desktop it always gets a emplyList as a response

> Task :composeApp:run
[]

CommonMain code

import androidx.compose.runtime.Composable
import app.cash.sqldelight.db.SqlDriver


@Composable
expect fun SQLD():SqlDriver

JvmMain Code

import androidx.compose.runtime.Composable
import app.cash.sqldelight.db.SqlDriver
import app.cash.sqldelight.driver.jdbc.sqlite.JdbcSqliteDriver
import com.example.db.MyDatabase

@Composable
actual fun SQLD():SqlDriver{
    val driver: SqlDriver = JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY)
    MyDatabase.Schema.create(driver)
    return driver

}

and i checked and i have the dependency implementation on jvm dependencies

jvmMain.dependencies {
            implementation(compose.desktop.common)
            implementation(compose.desktop.currentOs)
            implementation(libs.sqlDelight.driver.sqlite)
        }

and obviosly have set the plugin or else it wouldnt have worked on android

sqldelight {
    databases {
        create("MyDatabase") {
            packageName.set("com.example.db")
        }
    }
}
0

There are 0 best solutions below