简体   繁体   English

使用不同的 flutter 模块构建 flutter 应用程序

[英]Build flutter app with different flutter modules

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.我有我的本机应用程序,我们想将其更改为 flutter。为此,我们决定构建多个 flutter 模块并将其添加到现有的本机应用程序中。 I am not sure whether flutter support building multiple modules in a single native application.我不确定 flutter 是否支持在单个本机应用程序中构建多个模块。 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.同样在未来,由于我们想要完全摆脱原生,我没有找到任何解决方案,我们可以使用已经开发的 flutter 模块构建一个新的 flutter 应用程序。

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并将它们放在那里。

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

To add them to the current project, in your pubspec.yaml , you can do the following:要将它们添加到当前项目,在您的pubspec.yaml中,您可以执行以下操作:

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

These local modules are called path dependencies .这些本地模块称为路径依赖

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM