Getting this error Everywhere I specified a custom...
# serialization
w
Getting this error Everywhere I specified a custom serializer using @Serializable(with = SomeSerializer::class)
r
What does
MutableStateSerializer
look like? I assume it extends
KSerializer
?
w
Copy code
class MutableStateSerializer<T>(private val dataSerializer: KSerializer<T>) : KSerializer<MutableState<T>> {
override val descriptor: SerialDescriptor = dataSerializer.descriptor

override fun serialize(encoder: Encoder, value: MutableState<T>) =
    dataSerializer.serialize(encoder, value.value)

override fun deserialize(decoder: Decoder): MutableState<T> =
    mutableStateOf(dataSerializer.deserialize(decoder))

}
@Serializable(with = MutableStateSerializer::class)
var items = mutableStateOf(listOf<ListItem>())
r
Are
@Serializable
annotations supported on local properties (assuming it's not in a class)? I think you want to put it on the type. Other than that it looks good
w
var items is inside a class and the annotation is above it !
d
Looks like a bug, make an issue.
👍 1
j
@Waqas Tahir did you end up making an issue for this? We are facing the same problem
w
Yes made an issue