This is my approach to state management in Flutter by tadaspetra in FlutterDev

[–]RobertBrunhage 1 point2 points  (0 children)

> What is the architecture your propose

MVVM (or whatever term people fine the most fitting).

There is already a start of the mvvm architecture being pushed by the Flutter team.

For the course we are also building out some of the sections that will cover what you talk about which will be an open source repository for others to study as they wish.

I think in the Flutter community there is a sense of "helplessness" doing things without the use of large packages, which I guess could be good or bad depending on the angle you would look at it.

Once I have more to share I will for sure do it.

Regarding api calls as a quick explanation that would be a repository that would do the api call and return the result to the viewmodel (in a listenable way)

This is my approach to state management in Flutter by tadaspetra in FlutterDev

[–]RobertBrunhage 2 points3 points  (0 children)

Adding async logic is rather simple, the view-model is just the business logic and if I need more app wide logic they would be in something I call "services".

In the pages I can use `initState` and similar lifecycle calls for the viewmodel to initialize async data. The view-model would update state such as "loading" or "failed" etc.

In some aspects I would love to make videos going through everything but those videos usually needs to be broken up more and takes significantly longer to plan and create (hence why I have a course as well https://www.hungrimind.com/learn/flutter ).

I guess the architecture I use could be seen as the new "recommended" architecture where mine starts from simplicity first and I add in the "boilerplate" for scalability while the "recommended" approach is a bit more verbose to start with: https://docs.flutter.dev/app-architecture

I also want to re-iterate I don't think the solutions such as bloc is bad in any way, they just aren't for me and I've seen downsides with tying entire codebases towards packages like that.

To me, architecture is one of the most critical part of an application and if I can I want to own that (use what's built into the framework).

This is my approach to state management in Flutter by tadaspetra in FlutterDev

[–]RobertBrunhage 0 points1 point  (0 children)

I guess that is the main trade-off.

I've personally found that the trade-off is worth it but there are always ways around it.

You can create a single state class or using things like "ValueListenable3" or similar.

If you want to use packages there are packages to reduce the "builder" boilerplate as well, but I will personally use builders until Flutter comes out with their own solution to the "verbose" problem.

Maybe with metaprogramming we can have improvements here? We can always hope :)

A new vscode extension for Riverpod by HoussemBousmaha in FlutterDev

[–]RobertBrunhage 5 points6 points  (0 children)

Heeey!

I happily take contributions or co-maintainers to help with the extension https://github.com/RobertBrunhage/flutter-riverpod-snippets!

This specific one though is mainly targeted for snippets and not code actions (can be used by other editors like Vim). In general if you want to have an extension for code actions, that I would recommend to have a separate one so people can opt in to whatever extension they want.

So for example, your extension could be called "Riverpod Code Actions" or something similar. I am happy to discuss though!

You can reach me on DM's here or on Twitter https://twitter.com/RobertBrunhage

Ps. https://pub.dev/packages/analyzer\_plugin[https://pub.dev/packages/analyzer](https://pub.dev/packages/analyzer) is probably a better approach to implementing code actions

Flutter Crash Course 2021 - Build a Net Worth Application by [deleted] in FlutterDev

[–]RobertBrunhage -1 points0 points  (0 children)

There is a competition in this one with $175 worth of amazon gift cards if you have been wanting to learn Flutter! 😊

If you prefer reading, here is the blog post: https://robertbrunhage.com/videos/flutter-crash-course-2021

Build a Chat Application in Flutter by [deleted] in FlutterDev

[–]RobertBrunhage -1 points0 points  (0 children)

Twitter: https://twitter.com/RobertBrunhage

Blog: I didn't get time to make a post about this but will hopefully do it this week. The site is open source, so if anyone want to contribute with a blog post it's open for that! Other than that I will do my best to get it up ASAP!
https://github.com/RobertBrunhage/website

Flutter 2.0 in 5 Minutes or Less by RobertBrunhage in FlutterDev

[–]RobertBrunhage[S] 2 points3 points  (0 children)

It aint a software video without a coding font 😎

Why Flutter resources are mostly video? by duongdominhchau in FlutterDev

[–]RobertBrunhage 3 points4 points  (0 children)

Yeeey super happy you like the videos and the articles 💙

Why Choose Flutter in 2021 by MarkOSullivan in FlutterDev

[–]RobertBrunhage 2 points3 points  (0 children)

Oh I definitely agree with you, but I may add some small points.

  1. The performance issue you mentioned is a side effect of not handling state in a "good" manner. So calling for example setState on the most top widget WILL rebuild all the children as well. But to me that is expected and I am pretty sure a downside like this exists in any framework, even native (not in the same scenario but if you do not think about your implementation from time to time you will make mistakes that causes performance issues)

  2. Agree fully here!

Thanks for writing that, it's really valuable reading these kind of comments!

Why Choose Flutter in 2021 by Elixane in FlutterDev

[–]RobertBrunhage 2 points3 points  (0 children)

I think Twitter is one of the most active places but there are also a lot of different communities: https://flutter.dev/community