Flutter 错误:共享的“首选项”平台接口-1.0.3/pubspec.yaml:缺少所需的;名称“;领域

Flutter 错误:共享的“首选项”平台接口-1.0.3/pubspec.yaml:缺少所需的;名称“;领域,flutter,local-storage,sharedpreferences,Flutter,Local Storage,Sharedpreferences,在执行flatter pub get时,我在包上遇到以下错误。一个月前,我还在Github上打开了一个应用程序,但我没有幸运地得到任何正确的解决方案 Error on line 1, column 1 of ../../Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_platform_interface-1.0.3/pubspec.yaml: Missing the required "name" f

在执行
flatter pub get
时,我在包上遇到以下错误。一个月前,我还在Github上打开了一个应用程序,但我没有幸运地得到任何正确的解决方案

Error on line 1, column 1 of ../../Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_platform_interface-1.0.3/pubspec.yaml: Missing the required "name" field.
Running "flutter pub get" in numbertrivia...                            
pub get failed (65; Error on line 1, column 1 of
../../Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_platform_interface-1.0.3/pubspec.yaml: Missing
the required "name" field.)

要解决缓存包上的错误,可以使用命令
flatter packages cache repair
。它会强制重新下载每一个使用过的软件包,以防它被破坏

类似地,您可以在项目的
.packages
文件中查找特定包在缓存中的确切路径。然后,您可以删除它并运行
flatterpackagesget


这应该能解决你的问题。您可以了解有关常见错误的更多信息以及如何修复这些错误。

您是否尝试过
flatter clean
然后
flatter pub upgrade
?@在第1行执行
flatter pub upgrade
错误时遇到了相同的错误,.././Downloads/flatter/.pub cache/hosted/pub.dartlang.org/shared_preferences_platform_interface-1.0.3/pubspec.yaml的第1列:缺少所需的“名称”字段。正在numbertrivia中运行“Flatter酒吧升级”。。。发布升级失败(65;在.././Downloads/flatter/.pub cache/hosted/pub.dartlang.org/shared_preferences\u platform\u interface-1.0.3/pubspec.yaml的第1行第1列出现错误:缺少所需的“name”字段)。您可以尝试较旧的版本,mine在版本
共享首选项:^0.5.3+4
@xion上工作正常
共享首选项上出现相同错误:^0.5.3+4
谢谢帮助:D