gpt4 book ai didi

android - 错误: Member not found: 'packageRoot' ,如何解决忽略: deprecated_member_use in Flutter?

转载 作者:行者123 更新时间:2023-12-04 23:35:36 31 4
gpt4 key购买 nike

在我的flutter项目中,我对插件做了一些更新,然后使用了flutter upgrade。之后,每当我运行我的 flutter 项目时,它都会显示以下错误-

    /C:/src/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/platform-3.0.2/lib/src/interface/local_platform.dart:46:19: Error: Member not found: 'packageRoot'.
io.Platform.packageRoot; // ignore: deprecated_member_use
^^^^^^^^^^^ FAILURE: Build failed with an exception.

* Where: Script 'C:\src\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102

* What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 20s Exception: Gradle task assembleDebug failed with exit code 1
所以,我需要一个建议,我该如何解决这个问题?

最佳答案

你需要升级你的依赖来解决这个问题,所以运行:

flutter pub upgrade

如果这仍然不起作用,则意味着您遇到了来自 platform 的传递依赖的问题。 ( platform 低于 3.1.0 的版本有这个问题)。因此,覆盖 platform包装在您的 pubspec.yaml 中像这样的文件:
dependency_overrides:
platform: ^3.1.0

关于android - 错误: Member not found: 'packageRoot' ,如何解决忽略: deprecated_member_use in Flutter?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70363918/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com