How To Implement The Event Bus Pattern With Kotlin SharedFlow In Your Android App

Поділитися
Вставка
  • Опубліковано 6 вер 2024
  • Medium article:
    / how-to-implement-the-e...
    Are you an Android developer looking to learn about event-driven architecture? In this UA-cam video, we'll be discussing the Event Bus design pattern, which is commonly used in Android apps to achieve an event-driven architecture. While it has been largely replaced by Kotlin and other frameworks like Flow, RxJava, and LiveData, with the introduction of SharedFlows and StateFlows, it got way easier to implement the Event Bus pattern. We'll also be comparing the Observer with it and demonstrate how to use SharedFlows to implement the Event Bus design pattern in the context of Android development.
    Support me on Medium:
    / membership
    Follow me on:
    Twitter: / yanneckreiss
    Instagram: / yanneckreiss
    #android #kotlin #androiddevelopment #programming

КОМЕНТАРІ • 12

  • @justmeagain9302
    @justmeagain9302 3 дні тому

    Why not just use a normal suspending function to consume in this case only one event rather than a flow?

  • @markusmcgee
    @markusmcgee 7 місяців тому +1

    using this tonight lol. Need to knock out POC by tomorrow. This is part of it.

    • @yanneckreiss
      @yanneckreiss  7 місяців тому

      Good luck, you can do it 😎👍

  • @radbaver
    @radbaver Рік тому +2

    Amazing content! Thank you for sharing your advice with the community :)

  • @willi11319
    @willi11319 Рік тому +2

    amazing, keep up the great work!

  • @andresromerodev
    @andresromerodev Рік тому +1

    This is awesome, thank you!

  • @count7ero
    @count7ero Рік тому

    i still endorse the old event bus over just about every other pattern. apps have increasing richer and richer widgets that peek at multiple types in the model i.e. an update to a type in the model has an impact in multiple widgets in multiple screens. and you dont know which one will be the first to request an update (the app will not always open by user clicking the icon!!!) e.g. you have a friend list in a friend screen, but on the main screen you may have a menu "Friends 145", a wild notification "12 frends are interested in x" etc. i would never use observable pattern because it short-circuits the response to the source of the request. and to implement this pattern over and over, i would call this much more verbose actually. i would maybe only use observable/livedata/rx if i am bursted updates through a websocket and i consume them all in one place e.g. a list of stock tickers

  • @subindsuresh4897
    @subindsuresh4897 9 місяців тому

    Thank you bro.

  • @EmanNollase
    @EmanNollase Рік тому

    awesome!!

  • @rockerxillodiego
    @rockerxillodiego Рік тому

    nice

  • @nfaical3
    @nfaical3 Рік тому

    Thanks
    Can you share the source code ?