Modern Android codebases are becoming increasingly reactive. With concepts and patterns such as MVI, Redux, Unidirectional Data Flow, many componen...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks for your effort and for making the library!
I have one, a bit unrelated question: while introducing
safeOffer, you wrote: "But the function might throw an exception if the channel is closed for send." - When can this happen? How is it possible that the channel may be closed for send if its superior flow is not?Great question! You're right that in this case
isClosedForSendshould never returntruein the callback, but this is only because in the theawaitCloseblock we've unregistered / removed the callback from the widget. So this is somewhat a "defensive" approach to make sure we don't crash if we forgot to unregister the callback (which is arguably worse as we usually want to fail early but that's a different conversation).SendChannel.offeralso has other issues (note the 3rd point), so even whenisClosedForSendisfalsea subsequentoffercall might still throw and hence in thesafeOfferfunction we still need to wrap a try / catch aroundoffer.Hope that answered your question 😀
Don't want to upset you. But there is library which does the same: Corbind.
Are there some reasons why to create new one?
Yes I'm aware of Corbind! A couple of months into developing FlowBinding I found out about Corbind which also provides
Flowbindings along withactorandchannelbindings which existed before coroutines introducedFlow. I thought about moving on to something else but decided continue developing FlowBinding for a couple of reasons:Flow) which is safer API to expose to the consumer than channels.That said, from a user's perspective if you’re already using Corbind and are happy with it there’s probably little reason to switch; but if you are looking to migrate from RxBinding to a
Flowequivalent today, I think FlowBinding is a good option.Hope that answered you question 😀
Thanks for you detailed answer!
Have you thought about joining your efforts (e.g. tests) with author of Corbind? I guess, it's win-win situation for the community when instead of few same-functionality libraries we'll have one that offers strong and bug-less implementation.
There is good example in Kotlin-community: Arrow. Authors of two functional libraries joined their efforts to avoid ecosystem fragmentation.
Good luck!
Thanks! Will consider it.
both of you
FlowBindingandCorbindlibraries is awesome!!!I just love it. Really appreciate your Efforts.