var setterVisibility: String = "abc" // Initializer required, not a nullable type
    private set // the setter is private and has the default implementation
See: Properties Getter and Setter
You can easily do it using the following approach:
var atmosphericPressure: Double = 760.0
    get() = field
    private set(value) { 
        field = value 
    }
Look at this story on Medium: Property, Getter and Setter in Kotlin.
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