Table of content
Riverpod is a state management library for Flutter that utilizes the concept of providers and consumers to manage and share ‘state’ throughout an application. It's currently one of the fastest-growing and most liked state management solutions that exist for Flutter.
There are many State Management techniques out there, and Riverpod is just one of them. For me personally, Riverpod was the easiest to learn and it is the one I suggest to (Flutter) starters — which by no means implies it is the best fit for every single application. Each of the State Management solutions has its pros and cons. It is all about choosing the right solution for the application you are going to create, but Riverpod is a good place to start!
What is a ‘state’?
Before diving into how to manage states with Riverpod, it is necessary to understand what a state actually is and how it affects your application.
The state of an application is a condition or situation — an instance or a snapshot that shows the condition of your application at a certain point in time.
For example, your application has two variables, _counts and _color, with values 0 and red respectively. Let’s call this state “State A”. Now, if there is a user interaction that requires changing the values of your variables _counts and _color, let’s say to 1 and blue respectively, that would be a different state of your application, “State B”.