Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble getting Flutter to run in debug mode in VS Code

I am able to run my Flutter project in an emulator in Android Studio. I'm trying to run that same code in debug mode (f5) in VS Code, but I get an error saying:

Set the 'program' value in your launch config (eg 'lib/main.dart') then launch again.

So I updated my launch config to the following:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Dart & Flutter",
            "request": "launch",
            "type": "dart",
            "program": "lib/main.dart"
        }
    ]
}

After that update, when I try f5 I get the following error:

Your launch config references a program that does not exist. If you have problems launching, check the "program" field in your ".vscode/launch.json" file.

I DO have a main.dart file??

Any help would be greatly appreciated.

like image 686
user3735816 Avatar asked Jan 26 '26 00:01

user3735816


1 Answers

instead of "program": "lib/main.dart" try "flutterMode": "debug"

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Dart & Flutter",
            "request": "launch",
            "type": "dart",
            "flutterMode": "debug"
        }
    ]
}
like image 195
EdwynZN Avatar answered Jan 28 '26 17:01

EdwynZN



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!