Dart Code
Dart & Flutter support for Visual Studio Code

For instructions on installing the Dart or Flutter extensions, go here.

v2.20.0

Return of Inspect Widget

The Flutter: Inspect Widget feature that was added in v2.17.0 but disabled in v2.17.1 due to bugs is now re-enabled by default when using Flutter version v0.10.2 or later. This command allows you to tap on a widget on your device/emulator to highlight it and jump directly to the source code where it was constructed.

Lint Names in Problems View

VS Code now natively shows lint names and error codes in the Problems view so the dart.showLintNames setting has been removed.

Quick-Fix for Ignoring Lints/Hints

A new setting dart.showIgnoreQuickFixes (default: false) has been added that will add quick-fixes for ignoring lints and hints to the lightbulb menu.

These fixes will also show up in the Problems View.

Don’t Format Specific Files/Folders

Since VS Code does not allow per-folder/file settings, it’s now possible to stop certain files/folders from being formatted with the dart.doNotFormat setting. The setting is an array of string globs that are checked against the full file path.

"dart.doNotFormat": [
	"**/*.g.dart",
	"**/generated/**",
	"**/Google/flutter/**",
]

Note: Until this VS Code issue is implemented, this will stop both format-on-save and explicit Format Document calls from formatting.

Collapsed Call Stacks

When running in VS Code v1.29 (due in the next few weeks) stack traces will collapse “non-debuggable” code (based on your dart.debugSdkLibraries and dart.debugExternalLibraries settings).

Preview: build_runner Tasks

If you enable the dart.previewBuildRunnerTasks setting and your project references build_runner in its pubspec.yaml then new tasks will be registered with VS Code. You can find these by running the Tasks: Run Task, Tasks: Run Build Task, Tasks: Run Test Task commands in the palette. The tasks will appear as pub or flutter depending on the type of projects you have open.

Running the watch task will keep build_runner running in the background, re-building files as required when you save changes. If you wish to have the task run automatically when you start debugging you can add it as a preLaunchTask in your debug configuration.

Preview: toString() Calls in Debug Views

It’s now possible to force the debugger to call toString() on classes when displaying them in debug views (this includes the Variables pane, the Watch pane, tooltips and inline debug views) with the dart.previewToStringInDebugViews setting. This feature is experimental and may have a performance impact.

Before

After

Other Improvements

Note: This version requires VS Code v1.28 (up from v1.27).

Fork me on GitHub