How do you create a calculated property for this m...
# announcements
n
How do you create a calculated property for this model? New to Kotlin
h
I often use extension function for such purpose, something like
Copy code
fun Merchant.loc() = this.latitude to this.longitude
sorry if there’s any syntax error, I just type it out
n
that is...a lot of fields. anyway, just say
val loc get() = latitude to longitude
also you might like #C0B8MA7FA
n
Thank you - I was setting up the model incorrectly. I figured it out!
n
btw if that's java.util.Date, I'd suggest using java.time.Instant instead -- easier to work with, and not mutable. and generally more modern.