-1

在团队开发的 Flutter 项目中使用代码生成是个好主意吗?

如果是,是否可以指定单个文件flutter package pub run build runner

4

1 回答 1

1

从 build_runner build --help 输出:

--build-filter                  An explicit filter of files to build.
                                    Relative paths and `package:` uris are
                                    supported, including glob syntax for paths
                                    portions (but not package names).

他们的变更日志中有一个示例:

示例:以下将为应用程序构建和提供 JS 输出,并复制该应用程序所需的 SDK 资源:

pub run build_runner serve \
  --build-filter="web/main.dart.js" \
  --build-filter="package:build_web_compilers/**/*.js"

https://pub.dev/packages/build_runner/changelog#170

于 2021-03-07T18:27:41.483 回答