From my understanding of MVC Comming from .Net is that in MVC the useer interacts with the View which triggers the Controller and the controller returns a new View.But the examples I find for flutter the controllers does not really return new view they only update the state which updates the UI. This pattern is more like MVVVM than MVC. So what am i missing?
How can one implement MVC in flutter?
2
Answers
MVC started with Smalltalk, I believe. I learned MVC from the original ST80 image in 1982. The view paints controls, wired to the controllers, which arranges for the model to be updated. The model is being observed by the view and updates itself on changes.
I mimic this pretty close with Riverpod, using widgets for the view, action callbacks calling notifier mutation methods as the controller, and watching the provider in the view for updates. For me, this is closer to MVC than MVVM, which nearly always introduces an unnecessary layer in Flutter, and seems not to be good match.
Here we can simplify MVC (Model View Controller)
I recommend you to use Getx state management. Where you can easy practice and understand MVC pattern.
Getx is a popular state management package on pub.dev. Along side with state management you can find various help full things like routing etc.
I hope this can work for you.