23

When I try to debug a Flutter app in Vs Code, it hits the break point fine, but when I mouse over any variable to see its value, I get "< optimized out >< error >: < Invalid params >" tooltip. This started after I upgraded to 3.10 from 3.7. Happens both in macos and ios debugging including simulator and actual iphone.

I tried the steps below with no help:

  1. flutter clean
  2. delete /ios(macos)/Pods
  3. delete /ios(macos)/Podfile.lock
  4. flutter pub get
  5. from inside ios(macos) folder: pod install
  6. flutter run

And I can get the values of variables with print statement, that is the only way I can kinda debug now. I also deleted bin/cache directory of flutter sdk.

flutter doctor -v:

[✓] Flutter (Channel stable, 3.10.0, on macOS 13.3.1 22E772610a darwin-arm64, locale en-US)
    • Flutter version 3.10.0 on channel stable at /Users/aykut/Projects/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 84a1e904f4 (8 days ago), 2023-05-09 07:41:44 -0700
    • Engine revision d44b5a94c9
    • Dart version 3.0.0
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0-rc1)
    • Android SDK at /Users/aykut/Library/Android/sdk
    • Platform android-33, build-tools 32.0.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

[✓] VS Code (version 1.78.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.64.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 113.0.5672.92

[✓] Network resources
    • All expected network resources are available.

• No issues found!
starball
  • 20,030
  • 7
  • 43
  • 238
Aykut Ucar
  • 615
  • 8
  • 16
  • dup? https://stackoverflow.com/q/76247741/11107541. possibly related: https://github.com/flutter/flutter/issues/125289 – starball May 17 '23 at 02:32
  • 1) reminder: please add a [mre] (a minimal procedure that can be used to reliably reproduce the issue). 2) Once you've done that, would you mind please also [filing an issue ticket](https://github.com/Dart-Code/Dart-Code/issues/new?assignees=&labels=is+bug&projects=&template=bug_report.md&title=) with the same info to the VS Code Dart extension maintainers? Doing that may help to get an answer to your question. – starball May 17 '23 at 04:36
  • I've tried the same still no joy. Updated flutter to latest build, dart and devtools. As well as tried every possible combination of launch.json configs as well as certain VSC settings. Stopped short of going in to the trenches of Dart Flutter to try find why it optimises after a certain point and why it doesn't pick up the launch configs. – Cl0ud-l3ss May 18 '23 at 18:21
  • Same problem, is there a solution? Android Studio – Simonov Dmitriy May 26 '23 at 11:22
  • 2
    Issue seems to be being tracked in https://github.com/dart-lang/sdk/issues/52430 – starball May 26 '23 at 17:14
  • Does this answer your question? [VSCode debug ](https://stackoverflow.com/questions/76247741/vscode-debug-optimized-out) – starball Jun 28 '23 at 04:44
  • I didn't see anything in there that resolves my problem. – Aykut Ucar Jun 28 '23 at 19:20

1 Answers1

5

The only thing that worked for me is downgrading:

flutter downgrade 3.7.1
Yuriy N.
  • 4,936
  • 2
  • 38
  • 31
  • 3
    it worked for me without downgrading, the proplem happened to me only when debugging code inside a loop block like `somelist.where(() { })` but I'm still able to see the variables values in `vsCode debugging tap > variables` – Omar Qataberi Jun 17 '23 at 08:38