Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 432
Farah Bédoui Avatar asked Jul 15 '18 08:07

Farah Bédoui


People also ask

How do you solve the target of Uri doesn't exist?

Just open the terminal from the project directory and run. to Solve Target of URI doesn't exist 'package:flutter/material. dart' Error This problem has happened for several reasons. You have created a project and then you try to push the code to Git while your VS code is open.


2 Answers

Flutter Issue Fix: 18-April-2020

It happened due to :

  1. You have created a project and then you try to push the code to Git ( and keeping your vscode open)
  2. Your package needs to update using command flutter packages get ( simply from vscode menu choose terminal and then run this command )
  3. If you still it didn't fix your issue, simply go to File Menu, choose Close Folder, it fixes your issue.
  4. Last option restart VSCode.
like image 164
Shobhakar Tiwari Avatar answered Sep 28 '22 09:09

Shobhakar Tiwari


  1. ctrl -> Shift -> A (Find Action)
  2. Search for "Dart Analysis"
  3. Click the icon that says "Restart the Dart Analysis server"
  4. The red underline disappears from the package import and everything works.
like image 21
Mohamed Mesalm Avatar answered Sep 28 '22 08:09

Mohamed Mesalm