Is there a possibility to serialize Kotlin Data class with function literal?
I have following setup:
Kotlin data class:
data class Error(val throwable: Throwable, val reloadAction: (() -> Unit)? = null) : Serializable
Initialization of class:
val instance = Error(throwable,this::loadData)
Where this is ViewModel from Android Architecture components
When I'm passing this data class to parcelable:
parcel.writeSerializable(instance as Serializable)
I get following exception:
java.lang.RuntimeException: Parcelable encountered IOException writing serializable...