Does anyone have a good recommendation for a KMP l...
# multiplatform
j
Does anyone have a good recommendation for a KMP library for Pub/Sub event bus API ? I like Otto on Android how it uses Annotations to subscribe to events, but willing to try something new. Was considering rolling my own as my first attempt to find something reasonable came up short.
j
You can use flows from kotlinx.coroutines to create multiple, typed, direct links between parts of your codebase for sending both events and state changes.
Otto was truly awful. Signed, the person who was responsible for Otto.
😂 2
😬 1
j
@jw lol, was it that bad? We used it forever without any issues really, I think you did a good job with it at least the surface API we were exposed to. I will look into using flows for this, I just implemented something real quick inspired by Otto + iOS NotificationCenter but works for now, Flows might be best route. Here is an example.
Copy code
eventBus.publish(VehicleUpdatedEvent(vehicle))

...
eventBus.subscribe(this, VehicleUpdatedEvent::class) { event ->
   onVehicleUpdated(event.vehicle)
}