Didier Boelens' Reactive Programming BLoC or how to implement an app wide BLoC

▼魔方 西西 提交于 2021-01-01 09:55:29

问题


I was looking into quite a few pages to learn how to best implement an app wide bloc (for authentication, user management and initialization). I did not find so much and for a beginner regarding this level of bloc patterns I found it hard to identify a reasonable one.

The pattern by Didier Boelens explained here appears to be the most promising one.

  1. Is it still a sound pattern (it is from 2018) or did the bloc library evolve in the meantime or did other patterns proved better/easier? What would be an easier but still favorable pattern?

  2. The article starts with the bloc provided embedded in an InheritedWidget. If someone is familiar with this, could he/she explain please in simple words, why we need the bloc_event_state_builder and bloc_event_stream on top of bloc/event/state? Why can't I use a simple bloc/event/state pattern directly with the bloc_provider I read "Sometimes, handling a series of activities which might be sequential or parallel, long or short, synchronous or asynchronous and which could also lead to various results, can become extremely hard to program. You might also require to update the display along with the progress or depending on the states." but I guess I do not understand the orchestration of all elements of his pattern.

  3. He defines a class BlocProvider<T extends BlocBase> extends StatefulWidget referencing an inherited widget. I guess I assume correctly that this will impact all my other page specific blocs where I used the out-of-the-box BlocProvider from the bloc package?!

来源:https://stackoverflow.com/questions/64688230/didier-boelens-reactive-programming-bloc-or-how-to-implement-an-app-wide-bloc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!