Flutter VsCode error: You don't have an extension for debugging YAML

Viewed 12369

I get this error each time I try to start my app in VsCode

You don't have an extension for debugging YAML. Should we find a YAML extension in the Marketplace?

It was working before I add a font in pubspec.yaml, restarted my app and it didn't work anymore. I tried to restart VsCode, undo my changes, launch "flutter pub get" many times but nothing seems to work.

7 Answers

Click on "open a file", then navigate to the main.dart file and then click debug and run.

This mostly happens when you current file is the pubspec.yaml file. Just close or switch the main.dart or any .dart file. And it will work. Worked for me.

Just select main.dart file to start your app

Click debug and run.

enter image description here

The reason is that you are clicking on "Run and Debug" when you are at pubspec.yaml file. Just close it and go to main.dart and then Click on "Run and Debug".

Add .vscode/launch.json in your root folder

{
"version": "0.2.0",
"configurations": [
    {
        "name": "flutter_project", //<- Your Project Name
        "request": "launch",
        "type": "dart",
        "program": "lib/main.dart"
    },
    {
        "name": "Flutter",
        "type": "dart",
        "request": "launch",
        "program": "lib/main.dart"
    },   
 ]
}

enter image description here

'For that go to RUN > ADD Configuration > Dart & Flutter'

This worked for me! Thanks Joris

It seems that Dart & Flutter run configuration has to be selected.

For that go to RUN > ADD Configuration > Dart & Flutter

Related