MobX – using observables with the fewest lines of code
MobX is just another sort of reactive state management library that allows you to connect your reactive data directly to your UI using observables. The best part about MobX is that it requires the least amount of code you will need to create your apps. It takes away a lot of boilerplate code from you and allows you to generate most of it using the build_runner
command.
We will study the following concepts in MobX:
- Observables
- Actions
- The
Observer
widget - The Build runner dependency for the autogeneration of boilerplate code
Let's jump into setting up dependencies to create our counterexample application.
Adding MobX, Build Runner, and Codegen dependencies to the sample app
Just like on every other occasion, create a new Flutter app through the command line:
flutter create any_name_you_wish
You will get the same counterexample application with a default setState
widget implemented...