https://kotlinlang.org logo
Title
o

oday

02/18/2019, 1:34 PM
if requirementsAndInfo.key is nullable, that check inside the if is not sufficient to convince the parser that I did in fact check for nullability
a

alex

02/18/2019, 1:35 PM
Is it
var
?
o

oday

02/18/2019, 1:35 PM
no in this case it’s val
so it doesn’t do this
ok just got my answer
lol
still though! come on I mean its just one line under it, it’s going to give the “this is a mutable property that might have changed by this time” error?
j

Jonathan Mew

02/18/2019, 1:40 PM
I guess that's the risk with a potentially multithreaded application - I think it won't give that warning for a local variable but for a field it can't provide a safety guarantee.
👆 2
s

sitepodmatt

02/18/2019, 1:48 PM
requirementsAndInfo.key?.let { rTitleTv.text = it }
o

oday

02/18/2019, 2:10 PM
sure that’s a tighter way of writing it
s

sitepodmatt

02/18/2019, 2:50 PM
you dont need the surrounding 'if' and the compiler error is gone