I've got a `BehaviorSubject<Int?>`, but Inte...
# announcements
r
I've got a
BehaviorSubject<Int?>
, but IntelliJ is insisting that I have to pass an Int to onNext
m
I am not an expert on RxJava but as far as I remamber you cannot pass null. I guess that this is why there is
@NotNull
annotation before
onNext
argument and this is why you have this problem.
If so then there is no workaround and Kotlin is just securing you during compilation time from runtime errors 😉
a
@redrield RxJava does not support nullable types, use
Optional
r
thanks
p
Generally if you are convinced that you want to pass sth nullable to sth that is annotated as not nullable you need to write a proxy method using java
🦀 1
💩 1
d
in rxjava 1.x you could pass
null
, in rxjava 2.x you can't pass null through streams by design (i assume youre using 2.x)
☝️ 3