我刚把我的Macbook设置为扑动显影,

所以我下载了flutter SDK,并把它放在我的文档中。之后,我在命令行中设置了path变量来使用flutter。

我执行命令flutter create todolist,这样我就实现了一个空白项目。

我还用Dart-Code设置了我的visual studio代码,这样我就有了正确的语法高亮,智能感知等。

所以当我打开visual studio代码时,它会突出显示导入方法,如下图所示:

这意味着它还会突出显示正确的类,从而完全难以理解它是否是一个真正的错误。

我已经执行了pub get和flutter包get,并正确地得到了所有内容。 我的路径变量都是正确的。

为什么它突出显示它无法找到“导入”包?


当前回答

如果你已经使用了flutter packages get命令,错误仍然存在,你可以简单地重新加载VS code Developer: reload Window命令。简单地输入后按Ctrl+Shift+P (Cmd+Shift+P Mac用户)。它将清除错误。这就像刷新VS Code一样。

其他回答

I was using (goggle location picker (with much more customisation in functions and UI) ) so I copy this package(complete) and using in my app in one folder but since dart code analyser analyses one flutter project so I found that those which are referencing from inside of this package is not working then I copy only lib folder(of google location picker) in my original project folder and voila this worked for me. This solution took me a time of 3 days. I know this is not the question but it might help someone to save 3 days.

重新启动VS Code,你会看到神奇的效果! 如果这样不行,请检查pubspec.yaml中依赖项的缩进

重新启动android studio或visual studio。 运行命令 我-扑干净了。 Ii - flutter pub get Iii -颤振升级

如果这些工作不工作,试试这个:

检查你的dart SDK路径。

如果你已经使用了flutter packages get命令,错误仍然存在,你可以简单地重新加载VS code Developer: reload Window命令。简单地输入后按Ctrl+Shift+P (Cmd+Shift+P Mac用户)。它将清除错误。这就像刷新VS Code一样。

别忘了保存pubspec。Yaml之前运行“扑酒吧得到”。重新启动Visual Studio Code是不够的。这就是我的解。有时候当你和情报人员一起工作时,你会忘记…