AI-powered
podcast player
Listen to all your favourite podcasts with AI-powered features
How to Extend a Stateful Widget Into MVVM Workhorse
Stateful widget has everything I need for MVVM. The only problem with stateful widget from an MVVM standpoint is that it puts the UI in the states in the state class. So if you take the build function from the stateful widget state class and just move that into the stateful widgets portion, then you effectively have MVVM. And your state class would now have just your states and your business logic. Your stateful widget class would have your immutable states and your immutable build function. With 60 lines of code, I extended stateful widget into a view class. That's a generic class that that has a view model builder. It got something like 31 upvotes on flutter