Error: Not found: 'dart:ui' when trying to run a Flutter project
See original GitHub issueTrying to run a Flutter project in VS Code yields many errors like this: Error: Not found: 'dart:ui'
.
From looking at other issues (#2038, #1827) I understand that this is caused by trying to run a Dart project rather than a Flutter project. Well, I believe this is not the case in my project since the status bar does show Flutter and its version, in addition to selection of an emulator. The doctor also reports no issues whatsoever.
To Reproduce
I cannot share my code with the community (closed source), but the project opens and runs fine in both Android Studio and IntelliJ IDEA. The top-level directory contains a pubspec.yaml
with a line reading sdk: "flutter"
.
Expected behavior The project runs as a Flutter project.
Screenshots
Versions (please complete the following information):
- VS Code version: 1.64.2
- Dart extension version: 3.34.0
- Dart/Flutter SDK version: Flutter 2.11.0-0.0.pre.582 • channel master • Dart 2.17.0 (build 2.17.0-105.0.dev)
Issue Analytics
- State:
- Created 2 years ago
- Comments:17 (9 by maintainers)
Top GitHub Comments
@Chetan34123456 the two most common cases of this are:
pubspec.yaml
.F5
or the “other” run button, or the Run menu.If it’s neither of these, please run the Dart: Capture Debugging Logs command from the command palette (
F1
), try to run the app (to generate the error), then click Cancel on the logging notification to stop logging and open the log file, then file a new issue with the log attached.Note: The log will contain parts of your source, so best to repro in a clean project (created with the Flutter: New Project command).
if you have the code runner extension installed, you may end up with that extension and not the flutter one.