Hi there!
Here's the github repository where you can clone all the source code:
https://github.com/TheWCKD/blocFromZe...
In this tutorial I will introduce you to the newest changes introduced in the latest version of Flutter BLoC Library - 6.1.0. We'll talk in-depth about the newest concepts like context.watch(), context.select() and context.read() functions.
First of all, context.bloc() and context.repository() got deprecated and will be completely removed in future releases. As a consequence, other functions were added to facilitate the use of bloc library in the future: context.read, context.watch, and context.select.
Context.read is a way to read/access a provided instance of bloc/cubit and won’t rebuild the widget built within the context BuildContext. It should also be used only when and only where you need it to avoid multiple bloc/cubit lookups inside the widget tree.
Context.watch is a way to “subscribe” to a provided bloc/cubit and will rebuild the widget built within the context BuildContext, everytime there is a new state emitted. You can set up multiple context.watch in order to subscribe to multiple blocs/cubits as you would have a MultiBlocBuilder available, so that whenever at least one of the states is updated, the widget built, perhaps with the information needed from these states, will rebuild.
Context.select is also a newly introduced function from where you can easily update a widget based on a simple select condition. It was mainly added for users to have a simpler buildWhen method, when they want to update a widget from the UI as a response to that.
All animations were done in VideoScribe, you can try it by clicking my affiliate link --- https://www.awin1.com/cread.php?awinm...
You can contact me directly here:
Join my Discord Server --- / discord
Twitter --- / letsgetwckd
Instagram --- / letsgetwckd
Also, if you want to support me furthermore you can become an YouTube Member, donate or buy my courses on Udemy, using the following links:
Become an Official YouTube Member! ---- / flutterly
Buy my Udemy Courses! ---- https://www.udemy.com/user/tiberiu-po...
Support me on Revolut! ---- https://revolut.me/letsgetwckd
Buy me a Ko-fi! --- https://ko-fi.com/wckdyt
Donate me on Paypal! --- https://www.paypal.me/letsgetwckd
Support me on Patreon! --- / wckdyt