Nir Golan
03/17/2019, 9:35 AM.let
check for uninitialized too?karelpeeters
03/17/2019, 9:43 AMlet
doesn't really do anything, it's just a normal extension function. x
and x.let
both just evaluate x
first, and that does check for lateinit
.Nir Golan
03/17/2019, 9:45 AMCaused by: kotlin.UninitializedPropertyAccessException: lateinit property _presenter has not been initialized
whats the best way to check it if its initialized?karelpeeters
03/17/2019, 9:47 AMNir Golan
03/17/2019, 9:47 AMribesg
03/17/2019, 9:47 AMNir Golan
03/17/2019, 9:48 AMlateinit
to var and assign it with null first?karelpeeters
03/17/2019, 9:50 AMvar
😉. But most of the time yes, you gain the type safety you lost with lateinit
back.Nir Golan
03/17/2019, 9:52 AMvar
i meant for the null partNir Golan
03/17/2019, 9:52 AMribesg
03/17/2019, 10:22 AMlateinit
when you know that the variable will never be null
, for example when the value is always set, but outside of the constructor, like with injection or in Android’s onCreate