Flutter how to setup Android Studio when developing multiple projects
Apparently, it is possible to have multiple 'modules' open in AndroidStudio where a module can be either a Flutter application or a Flutter package. Hence it is perfectly possible to have the 'widgets' and 'app1'/'app2' open in a single window. This can be done by using "File/Project structure...", select "Modules" and click "+" and point to the iml file of the module you want to add.
Marc Van Daele
Updated on January 04, 2023Comments
-
Marc Van Daele over 1 year
I have three projects, one common widget package and two applications. I have the following directory structure
- widgets (pubspec.yaml, lib/, ..)
- app1 (pubspec.yaml, lib/, ..)
- app2 (pubspec.yaml, lib/, ..)
I can open them in three separate AndroidStudio windows but this has some drawbacks. A refactoring in eg widgets (eg renaming a widget or a function name) is not applied to app1 or app2.
So I'm wondering whether it is possible to open the three projects in a single AndroidStudio window so that refactoring is applied to all projects
-
Usama majid about 2 yearsI don't think you can do this!
-
Marc Van Daele about 2 yearsMight indeed be the correct answer. I'm sure I'm not the only one with this problem so I'm wondering how others tackle this and how their setup looks like.
-
OMi Shah about 2 yearsTry checking this out stackoverflow.com/a/32862637/5882307
-
Marc Van Daele about 2 yearsThanks for the link! However, this only works when developing for Android I guess.
-
Marc Van Daele about 2 yearsAlthough something similar is possible by using "File/Project structure...", select "Modules" and click "+" and point to the iml file of the module you depend on. This is certainly an improvement though a refactoring in a common library that impacts multiple applications still has to be done manually in the other applications.
-
Marc Van Daele about 2 years@OMiShah Your comment pointed me in the right direction so if you convert it to an answer, I can reward you the bounty.
-
OMi Shah about 2 yearsThank you for your generosity, but no thanks. I think you can reward me sometimes later or to somebody else. ;) @MarcVanDaele
-
Marc Van Daele about 2 yearsIf I open them in different windows, a refactoring in one window (eg renaming a widget method) will not have effect in the other window using this widget