Flying High with Flutter cover image

MVVM - Flying High with Flutter #79

Flying High with Flutter

CHAPTER

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

00:00
Transcript
Play full episode

Remember Everything You Learn from Podcasts

Save insights instantly, chat with episodes, and build lasting knowledge - all powered by AI.
App store bannerPlay store banner