'Generic Data class in Kotlin

Create a generic data class which has one variable data Type

data class <T> GenericResponse(
  val success: Boolean,
  val message: String,
  val data: T
)

To use it: GenericResponse<SomeOtherDataClass>

How to do this in kotlin?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source