In
https://xxfast.github.io/KStore/using-platform-paths.html#defining-your-own-directories
it's not very clear how to specify the paths for platforms.
In particular it's not reported that you might want to create an interface in common code
interface KStoreDbIface {
val user: KStore<UserV1>
val settings: KStore<SettingsV1>
}
expect fun provideKStoreDb(): KStoreDbIface
which is then implmented by the platform code.
E.g. in Android, where context is passed (e.g. via Koin DI)
actual fun provideKStoreDb(): KStoreDbIface = KStoreDb(context)
class KStoreDb(context: Context) : KStoreDbIface {
override val user: KStore<UserV1> = storeOf(
file = Path("${context.filesDir}/user.json"),
version = 1,
)
override val settings: KStore<SettingsV1> = storeOf(
file = Path("${context.filesDir}/settings.json"),
version = 1,
)
}
In
https://xxfast.github.io/KStore/using-platform-paths.html#defining-your-own-directories
it's not very clear how to specify the paths for platforms.
In particular it's not reported that you might want to create an interface in common code
which is then implmented by the platform code.
E.g. in Android, where context is passed (e.g. via Koin DI)