flutter packages pub run build_runner build

来源:13-4 背景墙开发

demonCry

2022-09-10

[INFO] Generating build script...
[INFO] Generating build script completed, took 407ms

[INFO] Precompiling build script......
[INFO] Precompiling build script... completed, took 6.0s

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 942ms

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Found 1 declared outputs which already exist on disk. This is likely because the`.dart_tool/build` folder was deleted, or you are submitti
ng generated files to your source repository.
[SEVERE] Conflicting outputs were detected and the build is unable to prompt for permission to remove them. These outputs must be removed manuall
y or the build can be run with `--delete-conflicting-outputs`. The outputs are: lib/video_page/video_model.g.dart
pub finished with exit code 78

之前因为使用 json_serializable 运行过 flutter pub run build-runner build

这里 flutter_gen_runner 再运行 flutter packages pub run build_runner build 就会报 Conflicting outputs were detected and the build is unable to prompt for permission to remove them. ...

虽然能通过 flutter pub run build-runner build --delete-conflicting-outputs 解决, 但会删除我们之前 json_serializable 生成的重新创建

我的问题是如果不想删除build-runner之前创建的有什么办法吗

写回答

1回答

马超老师

2022-09-26

这个报错的原因是在构建中出现了冲突,需要执行一次delete。

因为flutter pub 这个工具的设计是不会自动删文件,所以还是需要加--delete-conflicting-output来手动删除解决

0
0

基于Flutter 3.x 实战跨平台仿抖音App混合开发

以短视频APP为例,快速上手原生/Flutter 混合开发

481 学习 · 120 问题

查看课程