1

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?!

w461
  • 2,168
  • 4
  • 14
  • 40
  • Have a look at https://bloclibrary.dev/ and their examples, it's an excellent library that makes life a lot easier. Their examples cover the cases you mention. – nvoigt Nov 11 '20 at 13:41
  • Cheers, I have already "borrowed" their ToDo design, in the meantime :) – w461 Nov 11 '20 at 13:46

0 Answers0