I wonder if there is a way to check if a lateinit variable has been initialized. For example:
lateinit
class Foo() { private lateinit var myFile: Fi
Accepted answer gives me a compiler error in Kotlin 1.3+, I had to explicitly mention the this keyword before ::. Below is the working code.
Kotlin 1.3+
this
::
lateinit var file: File if (this::file.isInitialized) { // file is not null }