Implementing MVVM architecture
The need to implement proper architecture for the maintainability and scalability of an application is huge. Without proper architecture, it gets more and more complex to scale up the application or add new features. So, let’s start refactoring our Flutter Academy application by implementing the MVVM architecture.
We will start refactoring by organizing the folders first. We will organize the folders using one of the methods we discussed previously. As this application will be a medium-sized one once we complete this book, I am choosing to use functionality-based file organization. On top of that, I will use two layers, that is, an application layer and an infrastructure layer. Follow these steps to organize the folders for your own Flutter Academy application:
- Inside the
lib
folder, create two folders namedapp
andinfrastructure
. - Inside the
app
folder, we will again create the following folders:pages
res
routes
view_models
widgets...