原因是我直接从External Libraries 上,将安装包删掉了,然后在pubspec.yaml 中再次添加这个包,都安装不了了,运行了 Flutter Pub get
和 Flutter Pub upgrade ,Flutter Pub clean ,包括重启编译器,都不行,最后试了如下命令,就可以安装成功了,做个记录:
flutter pub cache repair
I have a similar problem I deleted a package from the dart packages folder and when I run flutter pub run it won’t download and work so I tried all the way people said but something worked for me is I tried to repairing pub cache and it worked just run.