Visual Studio Code - URI 目标不存在“package:flutter/material.dart" [英] Visual Studio Code - Target of URI doesn't exist 'package:flutter/material.dart'
问题描述
我刚刚为 Flutter 开发设置了我的 Macbook,
I've just set up my Macbook for flutter development,
所以我下载了 flutter SDK,并将其放置在我的文档中.之后,我在命令行中设置了路径变量以使用 flutter.
So I downloaded flutter SDK, and placed it in my Documents. After, I set up my path variable to work with flutter in my command line.
我执行命令 flutter create todolist
所以我实现了一个空白项目.
I execute the command flutter create todolist
so I achieve a blank project.
我还使用 Dart-Code 设置了我的 Visual Studio 代码,因此我有正确的语法高亮、IntelliSense 等.
I also set up my visual studio code with Dart-Code so I have the proper syntax highlight, IntelliSense, etc.
所以当我打开visual studio代码时,它突出显示了import
方法,如下图:
So when I open visual studio code, it highlights the import
method, like the following image:
这意味着它还突出显示了正确的类,使其完全难以理解是否是真正的错误.
This means that it also highlights the classes that are correct, making it completely hard to understand if it's a real error or not.
我已经执行了 pub get
和 flutter 包 get
并且一切正常.我的路径变量都正确.
I have executed both pub get
and flutter packages get
and got everything correctly.
I have my path variables all correctly.
为什么突出显示找不到导入"包?
Why is it highlighting it cannot find that 'import' package?
推荐答案
Restarting Visual Studio Code after
Restarting Visual Studio Code after
flutter pub get
为我解决了错误消息.
来源:https://flutter.dev/docs/development/包和插件/使用包
这篇关于Visual Studio Code - URI 目标不存在“package:flutter/material.dart"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!