And if you want to learn how to build a full-stack eCommerce app following these principles, you can sign up for my upcoming course and get a big discount when I open the pre-sale next month. 👇
What are some popular architectures that are suitable for Flutter App Development (and which one to choose)?
It boils down to what level of complexity you need to handle. 👇
Thread. 🧵
(1/2) Model–view–controller (MVC) is a software design pattern made of 3 types of components:
- Model: directly manages the data, logic, and rules of the application
- View: UI components (widgets)
- Controller: Accepts input and converts it to commands for the model or view
(2/2) MVC typically overloads the model with too much logic, and an additional service layer is often added: MVC+S
The Model should be reactive (e.g. using ChangeNotifier) so that the widgets rebuild when the model changes.
Here's how to use it to hide sensitive info when the app goes to the background. 🧵
How to set it up?
- add the WidgetsBindingObserver *mixin* to one of your classes (generally a State subclass)
- register the observer inside initState (and dispose it when done)
Then, just override the methods for the changes you want to keep track of.
In this case, we listen to app lifecycle changes and update a "foreground" flag via setState().