The website uses cookies to optimize your user experience. Using this website grants us the permission to collect certain information essential to the provision of our services to you, but you may change the cookie settings within your browser any time you wish. Learn more
I agree
Summary | 9 Annotations
var allByDefault: Int? // error: explicit initializer required
2017/09/17 12:07
Classes in Kotlin cannot have fields. However, sometimes it is necessary to have a backing field when using custom accessors. For these purposes, Kotlin provides an automatic backing field which can be accessed using the field identifier:
2017/09/17 12:26
The field identifier can only be used in the accessors of the property.
2017/09/17 12:28
If you want to do something that does not fit into this "implicit backing field" scheme, you can always fall back to having a backing property
2017/09/17 12:33
2017/09/17 12:33
compile time constants
2017/09/17 12:33
Top-level or member of an object Initialized with a value of type String or a primitive type No custom getter
2017/09/17 12:34
Such properties need to fulfil the following requirements:
2017/09/17 12:34
The modifier can only be used on var properties declared inside the body of a class (not in the primary constructor), and only when the property does not have a custom getter or setter. The type of the property must be non-null, and it must not be a primitive type.
2017/09/17 12:39