Hi there,
I have a shared kotlin module for my android and ios app
inside the module i am integrating local sql db using
Copy code
com.squareup.sqldelight
now, i have these classes
for kotin -
Copy code
expect class DbUtil() {
fun createDriver(): SqlDriver
}
fun createDatabase(driverFactory: DbUtil): MyDb {
return MyDb(driverFactory.createDriver())
}
for android -
Copy code
actual class DbUtil actual constructor() {
actual fun createDriver(): SqlDriver {
return AndroidSqliteDriver(RiyazDb.Schema, AppContextWrapper.appContext!!, DB_NAME)
}
}
object AppContextWrapper {
var appContext: Context? = null
}
now, how can i get the appContext here, right now it throws an null pointer exception