this leaves the config and constants files in the root of the lib folder, where my main_x.dart and main_common.dart files are. Because now my app.dart is in the presentation root, and I have my assets (dimensions, images, etc.) in a assets folder in the presentation. Think I'll take that and adapt to my structure. It's the same as with ViewModel in native android development, in my opinion, the ViewModel should be in the presentation layer.Īnd I do like your src structure. I initialize the managers (repositories), and whatnot, and give a way for the widgets to access that information via an InheritedWidgetįurthermore, I started using your approach: putting the blocs in the domain layer, but, after some discussion here in the subReddit, I agreed that the best place for the blocs is in the presentation layer, since they will interact directly with it and well. In my case, I created a "di" package for dependency injection where I put all the things that you can consider a "bloc provider". I have a couple of things different from what you have there, but overall I agree with the structure. I welcome all the feedback since I'm quite new to Flutter (just spent the last 2 weeks figuring it all out and learning about BLoC and Redux patterns). Overall, my proposed folder structure would look something like this: A similar approach is taken with auth.dart. Then, with screens.dart I expose the different screens that there could be this is mostly to use them in the routes.dart file so I don't have to do all the imports. I'm using an approach that attempts to work with a global app BLoC containing many other sub-BLoCs according to need. So, I am currently working on getting a proper folder structure (hopefully as close to Clean Architecture by Uncle Bob as it can) that makes sense in a Flutter project.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |