Flying High with Flutter cover image

MVVM - Flying High with Flutter #79

Flying High with Flutter

00:00

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

Transcript
Play full episode

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app