haroldadmin
10/31/2019, 7:32 PM@Parcelize
data class State(
val userId: String = 1234,
val userResource: Resource<User> = Resource.Uninitialized
): Parcelable
I want to exclude the userResource
property from being Parcelized, as the Resource
class is not Parcelable.
Here is the warning I get from the IDE: Type is not directly supported by @Parcelize. Annotate the field with @RawValue if you want to be serialized using 'writeValue()'
@Transient
does not work, and neither does @IgnoreOnParcel
(I get the warning that it is not applicable on properties in primary constructor). Any way to solve this?nglauber
10/31/2019, 7:47 PMharoldadmin
10/31/2019, 8:02 PM@Parcelize
data class State(
val userId: Int = 1234
): Parcelable {
private lateinit var resource: Resource<User>
constructor(missionId: Int, userRes: Resource<User>) {
this.resource = userRes
}
}
This, of course is not great because I lose immutability (resource is now a var). Also, the auto-generated copy function does not accept secondary constructor params.nglauber
10/31/2019, 8:23 PMrkeazor
11/01/2019, 12:13 PM