Search code examples
flutterdartvisual-studio-codevscode-debugger

VS Code / Dart - Variable inspector shows error string


When trying to inspect variables for a Flutter project in VSCode, it is often the case the inspector shows nothing of use. For instance, below we have a variable x of some type. There are no runtime errors but when setting a breakpoint, the inspector simply shows the following for the value of x.

<function errorString(error) {>

vs code variable inspector

The meaning of this is elusory since there is no related output in the debugging console. The breakpoints are being set within calls to Futures returning functions but it's hit and miss as to why most, but not all, variables cannot be inspected.

  • What do these error strings mean?
  • How can the root cause be determined (think stack traces in VS Pro)?
  • Why do they only show in break points but don't seem to affect runtime output?
  • How can the actual resolved state of the variable be inspected?

Solution

  • This was a bug in the Dart VS Code extension that has now been resolved:

    https://github.com/Dart-Code/Dart-Code/issues/3840

    Now the proper error message should be shown instead of the implementation of a function.