我最近在尝试编译 Flutter 应用程序时遇到错误。问题似乎与 firebase_core 包有关,该包似乎依赖于leak_tracker 和leak_tracker_testing 包。
当我依赖 firebase_core 包时,无论选择哪个版本,我都会收到以下错误:
../../../../../.pub-cache/hosted/pub.dev/leak_tracker_testing-2.0.3/lib/src/leak_testing.dart:146:9: Error: No named parameter with the name 'notGCed'.
notGCed: ignoredLeaks.notGCed.merge(
^^^^^^^
../../../../../.pub-cache/hosted/pub.dev/leak_tracker-10.0.4/lib/src/leak_tracking/primitives/model.dart:130:9: Context: Found this candidate, but the arguments don't match.
const IgnoredLeaks({
^^^^^^^^^^^^
../../../../../.pub-cache/hosted/pub.dev/leak_tracker_testing-2.0.3/lib/src/leak_testing.dart:193:9: Error: No named parameter with the name 'notGCed'.
notGCed: newNotGCed,
^^^^^^^
../../../../../.pub-cache/hosted/pub.dev/leak_tracker-10.0.4/lib/src/leak_tracking/primitives/model.dart:130:9: Context: Found this candidate, but the arguments don't match.
const IgnoredLeaks({
^^^^^^^^^^^^
我尝试重新安装 SDK 并升级它,但似乎没有解决问题。我迷失在寻找解决方案的过程中。
请帮帮我!
问题是您有两个相互依赖的版本冲突的软件包。可以是 flutter sdk 中的包,也可以是 pubspec.yaml 上安装的包。验证您的包裹。
在运行“flutter update-packages --force-upgrade”后,我遇到了同样的问题,可能是更新的软件包之一与已安装的任何其他软件包发生冲突。对我来说,它通过重新安装 flutter 和 dart sdk 来解决。
这些是我遵循的步骤:
首先,我完成了从 flutter 卸载页面中的所有步骤(https://docs.flutter.dev/get-started/uninstall?tab=windows)
根据您的配置重新安装 flutter sdk (https://docs.flutter.dev/get-started/install)
在终端运行“flutter doctor”并解决问题
我希望这可以帮助别人。