hi guys, may i know how use library voyager? have ...
# multiplatform
h
hi guys, may i know how use library voyager? have you face this problem https://github.com/adrielcafe/voyager/issues/488?
a
You can read on the official documentation website at state restoration topic
h
@Abdi but not working as suggestion
a
Can you share the code?
h
in the ticket itseld
Copy code
@Entity(tableName = roomDatabaseTableAsset)
data class AssetTable (
    @PrimaryKey val id:Int,
    val dateOfAsset:String?,
    val typeOfAssetId:Int,
    val categoryOfAssetId:Int,
    val description:String,
    val serialNo:String,
    val supplier:String,
    val invoiceDate:String?,
    val invoiceNo:String,
    val assetCost:Double,
    val nbvCost:Double,
    val conditions:String,
    val notes:String,
    val pictureUrl:String?
){
}
@Serializable
data class Asset(
    @SerialName("id")
    val id:Int,
    @SerialName("creation_date")
    val dateOfAsset:String?,
    @SerialName("type_id")
    val typeOfAssetId:Int,
    @SerialName("category_id")
    val categoryOfAssetId:Int,
    @SerialName("serial_no")
    val serialNo:String,
    @SerialName("description")
    val description:String,
    @SerialName("supplier")
    val supplier:String,
    @SerialName("invoice_date")
    val invoiceDate:String?,
    @SerialName("invoice_number")
    val invoiceNo:String,
    @SerialName("asset_cost")
    val assetCost:Double,
    @SerialName("nbv")
    val nbvCost:Double,
    @SerialName("conditions")
    val conditions:String,
    @SerialName("notes")
    val notes:String,
    @SerialName("picture_url")
    val pictureUrl:String?
)

fun Asset.toAssetTable():AssetTable{
    return AssetTable(
        id = this.id,
        dateOfAsset = this.dateOfAsset,
        typeOfAssetId = this.typeOfAssetId,
        categoryOfAssetId = this.categoryOfAssetId,
        description = this.description,
        serialNo = this.serialNo,
        supplier = this.supplier,
        invoiceDate = this.invoiceDate,
        invoiceNo = this.invoiceNo,
        assetCost = this.assetCost,
        nbvCost = this.nbvCost,
        conditions = this.conditions,
        notes = this.notes,
        pictureUrl = this.pictureUrl
    )
}
a
In commonMain - module core
Copy code
expect interface JavaSerializable
In androidMain - module core
Copy code
actual typealias JavaSerializable = java.io.Serializable
// non AndroidMain (ios, web, etc) - module core actual interface JavaSerializable And then your data class should be like this: data class AssetTable(/*...*/) : JavaSerializable
h
owh i see. @Abdi what about ios?
a
I still have not tried that in ios yet
e
Hey @hafiz how did you resolve this issue?
h
yes have manually impelementation java.io.Serializabl