Difference between Bloc Builder & Bloc Provider
♦ Bloc Provider
→ A bloc provider is a widget which is used to provide a single instance to multiple widgets in a tree → Bloc provider simplifies the process of creating instance, we just have to delegate the context param to the required cubit or bloc → In the children widget we can access the methods or functions of a cubit or bloc with the help of the Bloc provider instance. BlocProvider.of<T>(context).Method();
♦ Bloc Builder
→ A bloc builder is widget which is used to build widgets in a widget tree. → It also requires a bloc and a build method inside it. If we have provided bloc provider we don't have to worry about the instance it will automatically fetch it from the widget.
6
6
0