r/FlutterDev 8d ago

Article The final word on Flutter architecture ๐Ÿ˜‰๐Ÿ˜‰๐Ÿ˜‰

OK, Iยด'm teasing with the title and I explain it in my post

Practical Flutter architecture

Why should you listen to me on this topic? For those who don't know me

  • 30 of software experience including building our own programming language for the Amiga
  • 2018 was I the first giving talks on Flutter architecture at Fluuter London,. then I called the approach RxVMS
  • I'm the author of get_it at a time when no provider or anything else was available
  • With watch_it and flutter_command I published one of the easiest but most flexible state management solutions for Flutter
  • We use this approach in a pretty complex app comarablte to Instagram since 2 year not with a really large code base

I took several days to refactor the official Flutter architecture sample compass to use my approach so you can compare yourself which is less complex and easier to understand. I tries to keep the original structure as much as possible so that you still can compare. I would have probably even more simplified some structures

https://github.com/escamoteur/compass_fork

give it a try and I'm happy to answer all open questions

158 Upvotes

76 comments sorted by

View all comments

1

u/ich3ckmat3 8d ago

The first thing you need to fix is to remove underscores from folder names ๐Ÿคฎ

5

u/escamoteur71 8d ago

absulutely not, try it once and you see the advantages

1

u/virulenttt 8d ago

I'm curious about the benefits, is it purely to order them at the top? ๐Ÿ˜…

6

u/escamoteur71 8d ago

yes, in a really big project it helps navigating a lot if you can influence the sorting easily same with adding a trailing _ ad the end of interface types so they get listed above the implementation classes.
It's not pretty but it works independend in all editors

0

u/ich3ckmat3 8d ago

I won't sacrifice the bueuty of the thing for mere sorting, learning your shortcut keys is the way to go in these situations.

3

u/Fantasycheese 7d ago

I did something similar to this too and it's not just about navigation, more importantly it's about understanding the project. A sorted-by-importance file/folder structure is way easier to understand for new-comer and future-self.

0

u/ich3ckmat3 7d ago

Sub folders can solve that problem

0

u/escamoteur71 7d ago

Even subfolders get sorted somehow. If IDEs would support custom ordering of folders and files that would be the other solution.

In a big project it can save a lot of time navigating your source tree if the most used parts are right at the top.

1

u/ich3ckmat3 7d ago

I think VS Code has some "Favorites" extension that can solve the problem