Flutter Modular Architecture
Martin Jablečník

Martin Jablečník @mjablecnik

About: Hobby and Professional Software developer, OpenSource Enthusiast

Location:
Prague
Joined:
Dec 20, 2019

Flutter Modular Architecture

Publish Date: Dec 4 '21
12 5

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

Comments 5 total

  • Claudio Balbin
    Claudio BalbinJan 19, 2022

    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?

    • Martin Jablečník
      Martin JablečníkJan 21, 2022

      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.

    • Martin Jablečník
      Martin JablečníkFeb 16, 2022

      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)

Add comment