自生成.dart_tool/package_config.json文件后pubspec.lock文件发生变化,请运行"pub get"重新

The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "pub get" again

我尝试 运行 使用自定义预测试脚本在 codemagic 上进行测试。这是我的预测试脚本:

#!/bin/sh
cd libraries
cd dependencies
flutter pub get
cd ..
cd core
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
cd ..
cd ..
cd features
cd splash
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
cd ..
cd proposal
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs

这是我的 flutter 项目结构:

但是当 pre-test 是 运行ning 时,我得到这个错误:

Running "flutter pub get" in dependencies...                        2.5s
Running "flutter pub get" in core...                                4.9s
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "pub get" again.
pub finished with exit code 65
Running "flutter pub get" in splash...                              3.0s
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "pub get" again.
pub finished with exit code 65
Running "flutter pub get" in proposal...                            3.2s
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "pub get" again.
pub finished with exit code 65


Build failed :|
Step 4 script `Pre-test script` exited with status code 65

我认为这个错误是因为 flutter pub run build_runner build --delete-conflicting-outputs 当我想通过 codemagic 生成 .g.dart 文件时。

我尝试 google 但仍未找到解决方案,有人可以帮助我如何解决 codemagic 上的这个错误吗?

我用添加 flutter pub run 两次修复。

#!/bin/sh
cd libraries
cd dependencies
flutter pub get
cd ..
cd core
flutter pub get
flutter pub get // add again
flutter pub run build_runner build --delete-conflicting-outputs
cd ..
cd ..
cd features
cd splash
flutter pub get
flutter pub get // add again
flutter pub run build_runner build --delete-conflicting-outputs
cd ..
cd proposal
flutter pub get
flutter pub get // add again
flutter pub run build_runner build --delete-conflicting-outputs