I am following the official doc and trying to get ...
# squarelibraries
e
I am following the official doc and trying to get the SQLDriver on Android:
Copy code
actual class DriverFactory(private val context: Context) {
    actual fun createDriver(): SqlDriver {
        return AndroidSqliteDriver(Database.Schema, context, "test.db")
    }
}
I I am getting an error if I use this code with
generateAsync.set(true)
. What is the correct way to use async drivers?
s
You need to use schema.synchronous() method in android and ios createDriver() method as given below if u use
generateAsync.set(true)
Copy code
actual class DriverFactory(private val context: Context) {
    actual fun createDriver(): SqlDriver {
        return AndroidSqliteDriver(Database.Schema.synchronous(), context, "test.db")
    }
}
You can read more here: https://cashapp.github.io/sqldelight/2.0.1/js_sqlite/multiplatform/#:~:text=src/-,androidMain,-/kotlin
e
Thank you!