Adam Powell
07/27/2019, 3:47 PMobserve
that accepts an observer lambda, you have to supply both the LifecycleOwner
and the Observer
as lambdas or neither of them, since LifecycleOwner
is a SAM interface and kotlin's SAM conversion is all or nothing for a method. As for Observer
value nullability, yes, but the LiveData library still targets jdk7 and type annotations weren't a thing until jdk8, plus the nullability of LiveData values is a bit weird since it doesn't require a default value on construction; getValue
can return null
if a value hasn't been set yet.