I am using cubit as state management in my app. What's the difference between BlocBuilder and context.watch? Imho both react to a value change in the underlying Cubit / Bloc and trigger a UI build? I am not asking for a code implementation, but for a use case recommendation.
Flutter Difference between BlocBuilder and context.watch?
212 views Asked by Rasputin221 At
1
When comparing the two methods and looking at the documentation, you can infer that:
There is obviously more here and I can recommend reading up on it in the documentation. I would assume that in places where context is not available to you, you would maybe opt to use BlocBuilder.
Furthermore, context.watch is the same as calling Provider.of(context) and also can only be called StatelessWidget.build and State.build.
Also, I found this GitHub issue with some relevant information.