I wonder if there is a way to check if a lateinit variable has been initialized. For example:
class Foo() {
private lateinit var myFile: Fi
To check if a lateinit var were initialised or not use a .isInitialized on the reference to that property:
if (foo::bar.isInitialized) {
println(foo.bar)
}
This checking is only available for the properties that are accessible lexically, i.e. declared in the same type or in one of the outer types, or at top level in the same file.