https://kotlinlang.org logo
#rx
Title
# rx
i

iex

02/11/2020, 1:39 PM
is there something like
BehaviorSubject
but where the value is not optional?
k

kioba

02/11/2020, 4:02 PM
You mean a default value?
Copy code
BehaviorSubject.createDefault(1)
i

iex

02/11/2020, 5:40 PM
I mean, that I can call
value
on it and it returns the value, not an optional @kioba
k

kioba

02/11/2020, 6:38 PM
ahh, I don’t know any Subject that a non optional value. Behaviour subject can extended with a property which throws exceptions or returns a default value in case of missing
null
. Altho it works, Wouldn’t suggest the value usage. Sometimes i comes handy but on a longer terms it is a bad decision. Try to subscribe to the stream instead
8 Views