首页 > 解决方案 > 即使安装了包,它也没有显示在 dart 包文件夹中

问题描述

我在安装这个包时遇到问题https://pub.dev/packages/graphql_flutter/install它的依赖项之一是这个 graphql 包https://pub.dev/packages/graphql. 当我做 pub get it installs 时,它会显示 dart 包文件夹中 graphql 包的所有期望。我曾尝试单独安装 graphql 包,但该包仍然没有显示出来。并且导入仍然给出错误“URI目标不存在:'package:graphql/client.dart'。” 但它确实出现在 flutter/.pub-cache/hosted/pub.dartlang.org 中,所以我不明白为什么它没有出现在我的项目中。我尝试过使用flutter clean、flutter clean pub cache和androidstudio的invalidate caches/restart功能,但无济于事。我也尝试过多次重启 android studio 和我的电脑。我也尝试过以管理员身份运行 androidstudio。

这是我的 pubspec.yaml 这是我的 pubspec.yaml 文件

这是我的 Dart 包文件夹的一部分,你可以看到它没有显示这是我电脑上的 pub.dartlang.org 文件夹
在此处输入图像描述


在此处输入图像描述

标签: flutterdartflutter-graphql

解决方案


它最终在 3 天后被随机修复。我刚刚启动了android studio并再次尝试,突然它起作用了。不知道最后是怎么解决的


推荐阅读