[Solved] Which one is better between pure data class and a normal class with business logic in Kotlin?


Semantically speaking set() is not the best naming for what you’re actually doing. Since Kotlin supports extension functions, you can have both of the approaches at once.

data class BluetoothDef(
        val isChecked: Boolean = true,
        val status: Boolean = false
) : DeviceDef

fun BluetoothDef.with(context: Context) {
    BluetoothHelper(context).setBluetooth(this)
}

0

solved Which one is better between pure data class and a normal class with business logic in Kotlin?