You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter Web调试控制台无法访问已显示的本地变量问题求助

Flutter Web调试控制台无法访问已显示的本地变量问题求助

各位大佬好,我遇到一个Flutter Web调试的奇怪问题,想请大家帮忙看看:

我在VSCode里给代码打了一个断点,程序停在断点处后,在Variables -> Locals面板里明明能看到loadedMessages这个变量已经加载出来了,但我在Debug Console里输入这个变量名时,却收到了如下错误:

loadedMessages CompilationError: The getter 'loadedMessages' isn't defined for the class '$SimpleChatState'.
'
$SimpleChatState' is from 'package:alpacalaw/blocs/simple_chat/bloc/simple_chat_bloc.dart' ('lib/blocs/simple_chat/bloc/simple_chat_bloc.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'loadedMessages'.

我的launch.json配置如下:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Flutter Web",
      "type": "dart",
      "request": "launch",
      "program": "lib/main.dart",
      "args": [
        "-d",
        "chrome",
        "--web-port=5000",
        "--web-enable-expression-evaluation"
      ]
    }
  ]
}

我本来预期在Debug Console输入变量名后,能看到loadedMessages.toString()的结果,结果却出现了上述错误,有没有人能解释下这是怎么回事呀?

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.08 11:13:08