Each Kotlin property is made up of a field, a getter function, and a setter function. By default, the getter and setter are code-generated for you, but you can override those with custom implementations if desired.
To replace the getter function with your custom implementation, put the
getter function on the line after the property, using the get()
function name.
Here we use an expression body for the function, though you are welcome to use braces
and a return
statement if desired.
You can learn more about this in:
Tags: