I want to use a event bus in my project. I use kot...
# android
d
I want to use a event bus in my project. I use kotlin and coroutines but I don't use Rx. Can you recommend me what event bus to use or a good approach?
g
Opinion: Good event bus is no event bus
πŸ‘ 5
glitch crab 5
r
no event bus
r
No event busπŸ˜‚πŸ˜‚
People shouldnt be talking about eventbus in 2019πŸ˜‚πŸ˜‚
g
Actual answer depends on your use case of course, maybe you could provide what you want to achieve with event bus
d
The app has a bottom navigation bar. One option start a new activity with a form for create products, and another option show a list of products. In the list of products I can tap on a product for see the detail. If I stay in a product detail and I tap on first option the createProductActivity is started. When the product is created I need to refresh de list of product. How can I do it? [I'm spanish, sorry for my english]
r
your view can observe a Livedata of productList that is modified by CreateProductUseCase in a coroutine
πŸ‘ 1
to avoid bifurcation on success/error your Livedata could be an Either of productList
r
Yea observing a livedata object would work fine
g
Or Flow
r
lol
g
Yes Robert, I thought about you when wrote my message πŸ˜…
πŸ˜‚ 2
r
The problem with EventBus, is that its one hard to understand the flow of control in the application. Two its weird to tests(if you have tests)
r
event bus is not sequential, so you lost flow. Besides needed to much events for success and error
πŸ˜‚ 1
r
EventBus was good during a time when the Android Framework wasn't very friendly. But its been many years since than, and the ecosystem has grown.
Pow thank you @ruialonso thats what i've been trying to tell @gildor .Different usecases lol
r
πŸ‘
d
Can I see a sample o a project in github about this solution?
All the samples you will ever need lol
later guys, going back to bed. got work in the morning.
d
Thanks a lot guys
389 Views