My Flutter IDE (Android Studio) doesn't recognize material.dart
anymore! It happened suddenly, I was working normally then my PC turned off because of CPU 100% consumption and when I restarted I found this problem.

- 863
- 2
- 7
- 8
-
Restarting the IDE usually fixes it. You can also try deleting `~/.dartServer/.analysis-driver` – Günter Zöchbauer Jul 15 '18 at 09:28
-
I restarted my IDE several times but no clue :( ! and when trying to upgrade flutter or flutter packages it shows an exception "Oops; flutter has exited unexpectedly." – Farah Bédoui Jul 15 '18 at 09:34
-
Sounds like a harddisk problem. – Günter Zöchbauer Jul 15 '18 at 09:35
-
Have you tried deleting the mentioned directory? Perhaps the disk is too small? – Günter Zöchbauer Jul 15 '18 at 09:35
-
harddisk is 1 To not small at all ! my pc is ASUS i7 7th generation also so hard issu i think ! I didn't understand why should i delete the folder you mentioned? – Farah Bédoui Jul 15 '18 at 09:40
-
It's a cache for the dartAnalyzer with a ton of files wich might be corrupted. Deleting causes it to be recreated (I didn't have a need to do that since months, but worth a try I think). – Günter Zöchbauer Jul 15 '18 at 09:42
-
`flutter packages get` fixed the problem for me. – B Faley Mar 23 '19 at 17:52
11 Answers
- ctrl -> Shift -> A (Find Action)
- Search for "Dart Analysis"
- Click the icon that says "Restart the Dart Analysis server"
- The red underline disappears from the package import and everything works.

- 704
- 8
- 17
I tried this solution and it worked just perfect:
open terminal from the project directory and run
flutter packages get

- 484,302
- 314
- 1,365
- 1,393

- 179
- 1
- 3
-
In my case, I had to run "flutter packages upgrade" then. Hope It helps someone :) – hfunes.com Jun 11 '23 at 05:14
Flutter Issue Fix: 18-April-2020
It happened due to :
- You have created a project and then you try to push the code to Git ( and keeping your vscode open)
- Your package needs to update using command flutter packages get ( simply from vscode menu choose terminal and then run this command )
- If you still it didn't fix your issue, simply go to File Menu, choose Close Folder, it fixes your issue.
- Last option restart VSCode.

- 57,590
- 26
- 140
- 166

- 7,862
- 4
- 36
- 71
Solution that worked for me: inside your pubspec.yaml file, make sure that the name field (it's the first line of your pubspec.yaml file) has the correct name of the project. If it doesn't, change it and run pub get.

- 51
- 3
Check bupspec.yaml file. Something may be removed from there. I had the same issue and found out this problem and it's fixed now.

- 65
- 9
Taking a look into Flutters Github Issues there can be many causes.
- Your git causes this error (issue 19384)
Just delete every entry in your projects .gitignore on your maschine.
- There are some missing flutter packages (issue 17016)
Even when you've just installed flutter yet it can occur that some packages are going to be missed.
Going to the root of your Flutter project via command prompt and typing the command flutter packages get
will fix this.

- 951
- 1
- 15
- 36
-
This one, combined with the proposed VSCode restart from here, worked for me: https://stackoverflow.com/questions/44909653/visual-studio-code-target-of-uri-doesnt-exist-packageflutter-material-dart – Watth Aug 31 '20 at 12:55
For me, I needed to remove :
colons from the app description in the pubspec.yaml file, and run
flutter packages get

- 57,590
- 26
- 140
- 166

- 36
- 6
Add the following to the pubspec.yaml
environment:
sdk: '>=2.10.0 <3.0.0'
and then run
flutter pub get
.

- 30,962
- 25
- 85
- 135

- 1,377
- 1
- 8
- 13
This can also happen if you delete manually delete flutter package from Dart packages
. The solution in this case is to reinstall flutter SDK by erasing current User/flutter
folder and downloading a new one. Then run flutter packages get
and you should see all dependencies in place.