问题
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.
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?
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
andbloc_event_stream
on top of bloc/event/state? Why can't I use a simple bloc/event/state pattern directly with thebloc_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.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-boxBlocProvider
from the bloc package?!
来源:https://stackoverflow.com/questions/64688230/didier-boelens-reactive-programming-bloc-or-how-to-implement-an-app-wide-bloc