Redux – using unidirectional data flow
Redux, in the simplest terms, is an architecture with a unidirectional data flow. This means the screens just call the actions out and the changes from Redux models are directed back to the screens through the stores.
Redux has four major keywords that you will have to understand before you move to the code:
- Store – Holds the state object of the whole application
- Reducer – Updates the state based on the action it receives
- State – The current snapshot of the application's UI
- Actions – The instructions to update the states
Let's look at all of them in code and see how they function together to create a state management solution.
Adding a Redux dependency to a sample app
Create a new app using any name you want, just like we did in the previous chapter:
flutter create any_name_you_wish
You will get the same counterexample application with the default setState
implemented...