Search code examples
flutterdartvisual-studio-codebreakpoints

VsCode is not stopping on breakpoints - Flutter


Brand new to flutter and I'm using VSCode as my IDE. However, I can't seem to get VSCode to call any of my breakpoints I place. I've tried normal breakpoints, Expression Breakpoints. None of them are even registering.

Everywhere online says to change the launch.json which I have done as show below

"version": "0.2.0",
    "configurations": [
        {
            "name": "Flutter",
            "request": "launch",
            "type": "dart",
            "flutterMode": "debug"
        },
    ]

However it didn't do anything. I'm using android studio's emulator and sometimes chrome; works on neither. Any help is appreciated :)


Solution

  • Well, you can use the developer package to make breakpoints

    import 'dart:developer';
    
    void someFunction(double offset) {
      debugger(when: offset > 30.0);
      // ...
    }
    

    Look it in documentation