Flutter how to setup Android Studio when developing multiple projects

108

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.

Share:
108
Marc Van Daele
Author by

Marc Van Daele

Updated on January 04, 2023

Comments

  • Marc Van Daele
    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
      Usama majid about 2 years
      I don't think you can do this!
    • Marc Van Daele
      Marc Van Daele about 2 years
      Might 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
      OMi Shah about 2 years
      Try checking this out stackoverflow.com/a/32862637/5882307
    • Marc Van Daele
      Marc Van Daele about 2 years
      Thanks for the link! However, this only works when developing for Android I guess.
    • Marc Van Daele
      Marc Van Daele about 2 years
      Although 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
      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
      OMi Shah about 2 years
      Thank you for your generosity, but no thanks. I think you can reward me sometimes later or to somebody else. ;) @MarcVanDaele
  • Marc Van Daele
    Marc Van Daele about 2 years
    If 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