You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
4 months ago | |
|---|---|---|
| android | 4 months ago | |
| assets/images | 4 months ago | |
| ios | 4 months ago | |
| lib | 4 months ago | |
| test | 4 months ago | |
| .gitignore | 4 months ago | |
| .metadata | 4 months ago | |
| README.md | 4 months ago | |
| analysis_options.yaml | 4 months ago | |
| devtools_options.yaml | 4 months ago | |
| pubspec.lock | 4 months ago | |
| pubspec.yaml | 4 months ago | |
README.md
Build Runner 使用说明
Build Runner 是一个代码生成工具,用于自动化生成 Dart 代码。在本项目中,我们使用 build_runner 来处理各种代码生成功能,如 JSON 序列化、依赖注入等。
基本用法
flutter pub run build_runner build
这个命令会运行一次构建过程,生成所有必要的代码文件。
开发模式
在开发过程中,如果你希望在文件更改时自动重新生成代码,可以使用 watch 模式:
flutter pub run build_runner watch
这将启动一个监听器,当相关文件发生变化时自动重新构建生成的代码。
常用参数
--delete-conflicting-outputs: 删除与生成器输出冲突的文件--build-filter: 只构建匹配指定 glob 的文件
例如: flutter pub run build_runner build --delete-conflicting-outputs