Collecting flows in a lifecycle-aware manner

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024

Комментарии • 13

  • @trocchiettoski
    @trocchiettoski Год назад +1

    Manuel you are doing a lot of job to improve how Android should be taught. Finally you guys from Android speak slowly, put emphasis on the words, and furnish a lot of visual tools, and explain clearly the problem you are going to solve, then repeat in a structure what you say, and finally we have an app android now that put in practice everything.

  • @alco8864
    @alco8864 2 года назад +12

    The problem of the collect manner is too many workable ways that let junior developer may use incorrectly.

  • @İlyasŞavli
    @İlyasŞavli 8 месяцев назад

    You are a life saver brooo 🥳🎉🎉🎉🎉

  • @zekininadresi
    @zekininadresi 2 года назад +1

    That's why LiveData might be outdoing Flows. Integrating lifecycle into your flows this way always creates a new coroutine, for example, when the app is sent to bg (STOPPED) and brought back to fg (STARTED) again. If you had LiveData, you could just observe it w/out this overhead and latest data would always been republished when necessary.

    • @alexiitrotsenko3781
      @alexiitrotsenko3781 2 года назад +2

      Normally we should not be worried about yet another coroutine created - they as lightweight and thus cheap unlike threads

    • @javiere.gonzalez1021
      @javiere.gonzalez1021 6 месяцев назад

      LiveData is unfavorable because it exposes UI/Activity logic (the lifecycle) to your viewmodels. It makes separation of concerns between view/viewmodel blurry.

    • @sailor.seahell
      @sailor.seahell 6 месяцев назад

      @@javiere.gonzalez1021 at one point one way or another, the lifecycle will need to be accounted for - whether or not that's with livedata in the viewmodel or creating coroutines in the fragment/activity/composable to consume it in a lifecycle aware way there. unless android has a fundamental rewrite of the framework, we'll need to account for that. I think the argument around where those concerns interact is a valid one, as there are tradeoffs to both ways.

  • @albab790
    @albab790 Год назад

    Thanks

  • @omotexoman9860
    @omotexoman9860 Год назад

    thanks

  • @anthonyanthony3871
    @anthonyanthony3871 2 года назад +1

    Thankss and byebye live data

  • @kalidsherefuddin
    @kalidsherefuddin 2 года назад

    Ok thanks

  • @georgeshalvashvili6270
    @georgeshalvashvili6270 Год назад +4

    This API is just ugly, why do we have so many lambdas nested? Why not have it as clean as LiveData?

    • @-Alexey-
      @-Alexey- Год назад

      You can make your own extension and use it exactly like livedata.