Given the following code
class Foo(val bar: String)
val p = Foo::bar
How do I obtain the property type String from p?
If by obtaining you mean to check if the property is of type String, you can compare the returnType of the property with any other KType
Example
check(p.returnType == String::class.createType())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With