英文:
VS Code debug <optimized out> with Flutter 3.10 / Dart 3.0
问题
After the latest "flutter upgrade," I'm having problems viewing some variables during debug in VS Code.
How can I view the contents of variables when hovering instead of getting this?
Screenshot of hovering variable:
This only happens to some variables, others I can view the contents of as normal.
Flutter doctor output:
[✓] Flutter (Channel stable, 3.10.0, on macOS 13.2.1 22D68 darwin-arm64, locale
en-SE)
• Flutter version 3.10.0 on channel stable at
/opt/homebrew/Caskroom/flutter/2.10.0/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 84a1e904f4 (5 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
34.0.0-rc2)
• Android SDK at /Users/niklaselelid/Library/Android/sdk
• Platform android-33, build-tools 34.0.0-rc2
• Java binary at: /Applications/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• 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.11.3
[✓] Android Studio (version 2020.3)
• 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.10+0-b96-7281165)
[✓] VS Code (version 1.78.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.64.0
[✓] Connected device (2 available)
• iPhone 14 Pro Max (mobile) •
• ios
• com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
• macOS (desktop) • macos •
darwin-arm64 • macOS 13.2.1 22D68 darwin-arm64
[✓] Network resources
• All expected network resources are available.
I have looked for possible settings to configure the behavior.
英文:
After latest "flutter upgrade" I'm having problems viewing some variables during debug in VS Code.
How can I view the contents of variables when hovering instead of getting this
Screenshot of hovering variable:
This only happens to some variables, others I can view the contents of as normal.
Flutter doctor output:
[✓] Flutter (Channel stable, 3.10.0, on macOS 13.2.1 22D68 darwin-arm64, locale
en-SE)
• Flutter version 3.10.0 on channel stable at
/opt/homebrew/Caskroom/flutter/2.10.0/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 84a1e904f4 (5 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
34.0.0-rc2)
• Android SDK at /Users/niklaselelid/Library/Android/sdk
• Platform android-33, build-tools 34.0.0-rc2
• Java binary at: /Applications/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• 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.11.3
[✓] Android Studio (version 2020.3)
• 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.10+0-b96-7281165)
[✓] VS Code (version 1.78.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.64.0
[✓] Connected device (2 available)
• iPhone 14 Pro Max (mobile) •
• ios
• com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
• macOS (desktop) • macos •
darwin-arm64 • macOS 13.2.1 22D68 darwin-arm64
[✓] Network resources
• All expected network resources are available.
I have looked for possible settings to configure the behavior. Without luck.
答案1
得分: 19
你的代码没有问题。有一个与Dart SDK有关的问题尚未解决。请投票以吸引Dart团队的更多关注。
英文:
Nothing wrong with your code. There's an issue with Dart SDK, which is not resolved yet. Please upvote it to get more attention from the Dart team.
答案2
得分: 1
这是Dart 3.0的一个已知问题。在此处有相关跟踪。修复已在此提交中完成。修复信息由a-siva在此处宣布:
> 此修复将包含在Dart 3.1 Beta 3 / Flutter 3.13(beta通道)中,计划于2023年7月12日发布,并将在2023年8月16日进入稳定发布通道。
英文:
This is a known issue with Dart 3.0. It's tracked in Cannot debug values inside some if-statements: [sentinel kind: OptimizedOut] from evaluateInFrame()
#52430.
The fix has been made in this commit. The fix was announced here by a-siva:
> This fix should be in Dart 3.1 Beta 3/ Flutter 3.13 (beta channel) which is slated for release on July 12th 2023 and would make it into the stable release channel on 16 August 2023
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论