DEV Community

Martin Jablečník
Martin Jablečník

Posted on

Flutter Modular Architecture

If you are working on some big project, you can find that this project is bigger and bigger after some time and your controller, repository or view folders are full of hundred files..

Normal MVC project structure:
Normal MVC project structure

But with Modular you can split your application into more modules/features by scope and make your software more readable.

Project structure with modular:
Project structure with modular

Here is example of my project structure with modular:
Project structure with modular
Where in core folder I have classes, widgets and utils which are shared for every module. And every module is one peace of my project which is very simple and replaceable without any big impact in other modules.

Modular also solve dependency injection and routing between modules which are very nice solved.

Here is example of my main module file:
Example of my main module file

And my other module files:
Picking module fileInventory module file

Modular also works with any type of State Manager like Provider, RiverPod, Bloc, Cubit, Triple, MobX, GetX, etc..

More about Modular you can find here:
https://modular.flutterando.com.br/docs/intro
https://github.com/Flutterando/modular

Top comments (5)

Collapse
 
claudiobalbin profile image
Claudio Balbin

Nice article, I find the way that modular creates the store very easy to work with.
Do you mind sharing the code for better understanding?

Collapse
 
mjablecnik profile image
Martin Jablečník

Hello, so I created one little example with Modular.
You can find it here: github.com/mjablecnik/zebra_scanner
It is very simple project where is everything what you need (auth, settings, logs, internationalization, error handlers and few simple modules for example)

Collapse
 
mjablecnik profile image
Martin Jablečník

Unfortunately I don't have any open source project with Modular right now. But I plan create some simple example for better understand how it works.
When I will have it so I will let you know.

Collapse
 
tauamendonca profile image
Tauã Mendonça

Hi Martin!
I liked your article a lot and before I saw that you already made a project I asked the guys at Flutterando for examples to send you. I know it's probably late but I will leave them here if it helps anyone:

github.com/Bwolfs2/coffsy_movie_app
github.com/OrlandoEduardo101/whats...
github.com/OrlandoEduardo101/todo_... (this one I think it's useful though in Orlando's words: "This one is a backend implementation, but it's incomplete and lacks documentation for now")

Thread Thread
 
mjablecnik profile image
Martin Jablečník

Thank you very much for your sharing :)