How to properly structure flutter project with API & Local data storage? [closed] How to properly structure flutter project with API & Local data storage? [closed] dart dart

How to properly structure flutter project with API & Local data storage? [closed]


There is no right or wrong on how to structure your Flutter project. You can put everything in a single file. Also it depends on the package its being used, for example I use BLoC as state management and these are some project structures that the package recommends:

I don't use any of those, I made my own project structure that I will explain in a moment. There's a package layout convention for Dart (not for Flutter projects).

I use the following structure:

├──lib/│  ├──blocs/│  ├──models/ │  ├──repositories/│  ├──screens/│  ├──utils/│  ├──widgets/│  └──main.dart

I separate everything in folders so front-end devs can work on the widgets folder where there is all the design stuff and back-end devs can works on the blocs folder where there is all the logic.

Remember there is no wrong or right answer. Check-out your recommended project structure that your favorite state management package recommends or watch this talk: Keep it Simple, State: Architecture for Flutter Apps (DartConf 2018)