Build flutter app with different flutter modules

542

It is possible. What you can do is create modules (packages) somewhere in your project, for example, create a directory modules and place them there.

.
├── modules
│   ├── module1
│   ├── module2
│   ├── module3
│   └── module4

To add them to the current project, in your pubspec.yaml, you can do the following:

dependencies:
    # ...
    module1:
        path: ./modules/module1
    # ... etc for other modules

These local modules are called path dependencies.

Share:
542
rohit shivankar
Author by

rohit shivankar

Updated on December 01, 2022

Comments

  • rohit shivankar
    rohit shivankar over 1 year

    I have my native application, which we want to change into flutter. For that, we have decided to build multiple flutter modules and add that to the existing native application. I am not sure whether flutter support building multiple modules in a single native application. Also in the future, as we want to move away from native completely, I didn't find any solution where we can build a fresh flutter application using already developed flutter modules.

    • lava
      lava about 2 years
      you can use flutter with your native android.docs.flutter.dev/development/add-to-app/android/proj‌​ect-setup
    • rohit shivankar
      rohit shivankar about 2 years
      Yeh..I did that for one module..but the query I have is around multiple modules and cross interaction beween different modules and how to build a fresh flutter app with various flutter modules.