i'm working on ubuntu with vs code with dart but while runing i get this error " Set the 'program' value in your launch config (eg 'bin/main.dart') then launch again " and i have add in lanuch.json
"program": "bin/main.dart",
and i get this error
Error when reading 'bin/main.dart': No such file or directory. i have installed dart using this steps https://dart.dev/get-dart
Ok, so I was struggling with this as well and I felt like previous answers while correct, they don't address the issue for beginners. The issue seems to be that VS Code wants to know which is the file that it needs to debug, so if you type in the relative path to your file it will work right away.
In my case my file was named helloWorld.dart, so I had to specify that in the launch.json file.
it ended up looking like this:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Dart & Flutter",
"request": "launch",
"type": "dart"
"program": "helloWorld.dart",
}
]
}
I advise using the full path to prevent issues that could arise from a different folder structure.
I guess the reason VS Code ask for bin/main.dart is because you are supposed to create that folder structure and main.dartis the most common/default file name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With