Not sure how to add additional field which is not part of json Response. Found similar issue & i tried the solution but no luck for me :( , getting an error, not sure how to fix it.
here is code snippet for data class :
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.Parcelize
@Parcelize
@Entity(tableName = "personality")
data class Personality(
@SerializedName("id")
@PrimaryKey(autoGenerate = false)
val id: Int ,
@SerializedName("full_name")
val fullName: String,
@SerializedName("born")
val born: String?,
// 'isFavourite' is additional field other than JSON Response
private var _isFavourite: Boolean = false
): Parcelable {
var isFavourite
get() = _isFavourite?:false
set(value) {
_isFavourite = value
}
}