2022年6月6日星期一

Target of URI doesn't exist 'package:flutter/material.dart'

 Target of URI doesn't exist 'package:flutter/material.dart'

I've just set up my Macbook for flutter development,

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.

I execute the command flutter create todolist so I achieve a blank project.

I also set up my visual studio code with Dart-Code so I have the proper syntax highlight, IntelliSense, etc.

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.

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?

androidflutterdartvisual-studio-codeflutter-packages

Share

Follow

edited Mar 10, 2021 at 11:53


Paresh Mangukiya

37.4k17

17 gold badges

201

201 silver badges

182

182 bronze badges

asked Jul 4, 2017 at 15:25


James

3,0663

3 gold badges

19

19 silver badges

33

33 bronze badges

Show 7 more comments

Report this ad

36 Answers

Sorted by:

                                              Highest score (default)                                                                   Date modified (newest first)                                                                   Date created (oldest first)                              

1

2Next

416

Restarting Visual Studio Code after

 

open terminal

 

cd to the project with file “pubspec.yaml”

 

flutter packages get

 

resolved the error messages for me (previously flutter pub get)

source: https://flutter.dev/docs/development/packages-and-plugins/using-packages


沒有留言:

發佈留言