Lateinit modifier for Kotlin usage skills
The question in the Kotlin definition of variables or attributes need to initialize the value, and the definition of variables or attributes are private by default, then there is a way not to assign values at the time of definition, the answer is yes. The definition of attribute or variable is divided into the following two cases: 1, ordinary attribute / variable definition; 2, using annotations to define variable / attribute; for 1 case, the solution is ordinary definition, with the keyword lateinit modified.
For two cases: it may change slightly, if you use kapt to process annotations before using lateiinit to modify:
After decorating with lateinit:
Note: lateinit-decorated variables / attributes cannot be primitive data types