Tech
02/27/2023, 1:30 AMdata
field where in Kotlin I serialize into this basic object
@Serializable
data class PayloadData<T>(
val error: Boolean,
val data: T? = null
)
However, sometimes when no data needs to be sent back the data field sent back is undefined, and I try to set the type of PayloadData to Void and kotlinx serialization fails, was wondering if there was a way to handle this case?ephemient
02/27/2023, 1:54 AMNothing
, so PayloadData<Nothing>(data = null)
should workTech
02/27/2023, 1:55 AMephemient
02/27/2023, 1:57 AMNothing
, but there is null: Nothing?
Tech
02/27/2023, 1:58 AM