# Flutter: “Target of URI doesn’t exist: ‘package:flutter/material.dart’”

> Target of URI doesn’t exist: package:flutter/material.dart. Run flutter pub get, open the folder with pubspec.yaml, and point the editor at the Flutter SDK.

Canonical: https://app369.com/fix/flutter-target-of-uri-doesnt-exist/
Last updated: 2026-11-08

VS Code or Android Studio underlines every import in red: Target of URI doesn’t exist, for package:flutter/material.dart or a package you just added. The Dart analyzer can’t map the package name to a folder on disk. The code is usually fine; the project’s packages haven’t been fetched, the editor opened the wrong folder, or it isn’t using the Flutter SDK.

**Short answer**

Run flutter pub get in the folder that holds pubspec.yaml. Open that folder itself in the editor, not its parent. If the error stays, check the editor uses the Flutter SDK (in VS Code, Command Palette, Flutter: Change SDK) and run Dart: Restart Analysis Server. For package:flutter, pubspec.yaml must list flutter: sdk: flutter under dependencies.

## **Why the analyzer can’t find the package, and the fix**

1. 01 ### **The packages were never fetched**
  > “To map packages back to the system cache, this command creates a package_config.json file in the .dart_tool/ directory.” [**Dart, dart pub get**](https://dart.dev/tools/pub/cmd/pub-get) A fresh clone, a branch switch or a new line in pubspec.yaml leaves .dart_tool/package_config.json missing or out of date. Without it, no package: import resolves. Fetch them from the project folder.```
flutter pub get
```
2. 02 ### **The editor opened the wrong folder**
  > “Ensure that the folder that contains your pubspec.yaml is inside a VS Code Workspace Folder” [**Flutter, Visual Studio Code**](https://docs.flutter.dev/tools/vs-code) Opening a parent folder, or a monorepo root, hides the project from the Flutter extension, and the status bar shows no Flutter version. Use File, Open Folder on the folder that contains pubspec.yaml.
3. 03 ### **The editor isn’t using the Flutter SDK** With only a standalone Dart SDK, or a stale path after moving Flutter, the analyzer has no flutter package to find. In VS Code run Flutter: Change SDK, or set dart.flutterSdkPath in settings.json, then Dart: Restart Analysis Server. In Android Studio, set the path under Settings, Languages & Frameworks, Flutter.```
// .vscode/settings.json
{
  "dart.flutterSdkPath": "/Users/you/develop/flutter"
}
```
4. 04 ### **pubspec.yaml doesn’t depend on Flutter, or the import is mistyped**
  > “The analyzer produces this diagnostic when an import, export, or part directive is found where the URI refers to a file that doesn't exist.” [**Dart, uri_does_not_exist**](https://dart.dev/tools/diagnostics/uri_does_not_exist) A project made with dart create has no Flutter dependency. Add it, then run flutter pub get. For any other package, check the name matches pubspec.yaml exactly.```
dependencies:
  flutter:
    sdk: flutter
```

Checked against the vendor’s docs on November 8, 2026: [Dart: dart pub get](https://dart.dev/tools/pub/cmd/pub-get); [Flutter: Visual Studio Code](https://docs.flutter.dev/tools/vs-code); [Dart diagnostics: uri_does_not_exist](https://dart.dev/tools/diagnostics/uri_does_not_exist).

## **Rather hand it over?**

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

- [from $450**App Fix Ticket**One reproducible bug in an existing mobile or web app, diagnosed and fixed.**See scope and start**](https://app369.com/fixed-price/flutter-firebase-bug-fix/)
- [from $450**AI-Built App Rescue**A Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.****No issues worth fixing, no charge.**** If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.**See scope and start**](https://app369.com/fixed-price/ai-app-rescue/)

Related: [**flutter: command not found**](https://app369.com/fix/flutter-command-not-found/) · [**Flutter pub “version solving failed”**](https://app369.com/fix/flutter-pub-version-solving-failed/) · [**Flutter “Unable to load asset”**](https://app369.com/fix/flutter-unable-to-load-asset/) · [**Flutter “type 'Null' is not a subtype of type 'String'”**](https://app369.com/fix/flutter-type-null-is-not-a-subtype-of-type-string/)

Questions

## **More on this error**

<details>

<summary>**flutter pub get worked but the red lines stay. Why? **+</summary>

The analyzer is still showing old results. Run Dart: Restart Analysis Server in VS Code, or File, Invalidate Caches in Android Studio. If that doesn’t help, delete .dart_tool and run flutter pub get again.

</details>

<details>

<summary>**Should I commit .dart_tool? **+</summary>

No. It is generated on each machine by flutter pub get; add it to .gitignore. For an app, commit pubspec.lock instead.

</details>

<details>

<summary>**Can you fix it for me? **+</summary>

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.

</details>

A different error?

## **Describe it and get a written quote**

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; Simon replies by email, usually within one business day.

[**Describe your problem **→](https://app369.com/contact/) [**All fixes**](https://app369.com/fix/)