Hello! I'm wondering if anybody knows of a simple ...
# android
c
Hello! I'm wondering if anybody knows of a simple way to avoid
data class
duplication when using room. I have a
data class
from a custom library (Kotlin but NOT Android). I have an Android app that uses that library and will store some items of that
data class
. But as far as I can see, I don't find an easy way to create an
entity
from that library
data class
. Any ideas?
I've done a secondary constructor for my entity for now.
Copy code
@Entity
data class DataEntity(val value: Int) {
    constructor(data: Data): this(data.value)
}
I hope it's good enough 😛