解决Flutter Conflicting outputs were detected and the build is unable to prompt for permission to r...

PS:今天从GitHub上拉下来之前写的Flutter项目,然后运行 flutter packages pub run build_runner build 出现了如下报错日志:

解决Flutter Conflicting outputs were detected and the build is unable to prompt for permission to r..._第1张图片
666.png
原因如下:

原因其实日志也说明了,在提交代码的时候把flutter packages pub run build_runner build生成的xxxx.g.dart也提了上去。运行flutter packages pub run build_runner build不光生成了xxxx.g.dart。同时还成了一个dart_tool/build目录,入过程所说的只运行app是没有问题的,之前xxxx.g.dart还是可用的。但是再生成新的xxxx.g.dart因为缺少之前生成dart_tool/build目下的文件就会报错。

那么怎么解决呢?莫慌,运行两行命令即可:
flutter packages pub run build_runner clean
flutter packages pub run build_runner build --delete-conflicting-outputs
小编也是在Flutter探索之路上,希望小小的分享能对读者有所帮助^^

你可能感兴趣的:(解决Flutter Conflicting outputs were detected and the build is unable to prompt for permission to r...)