Big Chungus
02/03/2021, 2:28 PMimport kotlinx.serialization.*
@Serializable
data class PagedResponse<T>(
val data: List<T>,
val total: Int,
val next: String?,
val prev: String?,
)
And when I fetch something from the backed via ktor client I get this (request itself is successful and that same class is serialized on the backand fine):
ERROR[]: Can't find a method to construct serializer for type PagedResponse. Make sure this class is marked as @Serializable or provide serializer explicitly.
Any ideas anyone?? I'm completely lost...Jakub Gwóźdź
02/03/2021, 2:32 PMplugins {
kotlin("multiplatform") version "1.4.10"
kotlin("plugin.serialization") version "1.4.10"
}
at the top of the gradlew.build (I'm using that in mutliplatform project, with js-browser part correctly using ktor-client and serialization.
also, here's top of my dependencies, might help you:
fun ktor(name: String) = "io.ktor:ktor-$name:1.4.1"
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.0")
implementation(ktor("client-serialization"))
implementation(ktor("client-json"))
// implementation(ktor("client-logging"))
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.1.0")
}
}
(jsMain adds kotlinx-html-js only)Big Chungus
02/03/2021, 7:48 PMShabinder Singh
05/15/2021, 7:44 PMBig Chungus
05/15/2021, 7:52 PMShabinder Singh
05/15/2021, 7:52 PM