David Gonzalez
Jun 20, 2023

--

The role of the viewmodel is not very clear in your example, because it only wraps a list.

Moreover, i think that statefull widgets can play the role of the view model, as they produce the structure of the ui.
For example, through widgets, you retrieve your service (MyService.of(context)), execute methods on them, obtain a result, and finally convert that result into (stateless most of the time) widgets.

Widgets produce RenderObjects, which actually render the ui. I think they compose the UI layer of the Mvvm.

I agree this is not very clear, because i differenciate stateless from statefull widgets, but think about where all ui interactors (such as controllers or some mixins) are located: the State of a statefull widget.

--

--

David Gonzalez
David Gonzalez

Written by David Gonzalez

Hi, I’m David, a french mobile applications developer. As a freelance, I work on Android and iOS applications since 2010. I also work on Flutter now !

No responses yet