StateProvider Widget: Read Function
Learn about the StateProvider widget in Riverpod and how the read function works.
Reading the StateProvider
The following controller widget is the most important one, where we have used the Riverpod’s read() method to change the state of the provided objects.
We can notice that we have passed the BuildContext context inside each method, so the data flows through that context, and we can read the Provider state. The Provider state object is either integer, or string, or even a data class. However, in each case, the distinction is clear enough. Because our application logic is clear, it’s become easier for us to visualize what will happen.
In our application, we have pressed several buttons, however the Scaffold widget has not been rebuilt. You can track the widget ...