Dart Code
Dart & Flutter support for Visual Studio Code Discord Chat Follow on Twitter Contribute to Dart Code

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

v3.10.2 2020-05-16

v3.10.1 2020-05-03

v3.10.0 2020-05-01

Main Function CodeLens

#2356/#2359/#2373 CodeLens links are now available on main() methods for both applications and test scripts. This allows running the current file even if the current launch configuration specifies another script. These links can be toggled using the dart.showMainCodeLens setting.

The template field in a launch config (see below for an example) has been extended to support templating these CodeLens.

Run Tests on Device

#2363/#2374: A new launch config flag runTestsOnDevice has been added that allows you to create launch configurations that will run tests with flutter run on the select device instead of using flutter test.

Using the two features above together, you can add CodeLens links to easily run test scripts on a device:

{
	"version": "0.2.0",
	"configurations": [
		{
			"name": "Flutter App",
			"request": "launch",
			"type": "dart"
		},
		{
			"name": "Debug Tests on Device",
			"request": "launch",
			"type": "dart",
			"runTestsOnDevice": true,
			// This adds this config to CodeLens for test files
			"template": "debug-test-file"
		}
	]
}

Pub: List Outdated Packages

#2322/#2350: A new Dart: List Outdated Packages command has been added that runs pub outdated. It’s also available on the context menu and editor toolbar for the pubspec.yaml file.

This command will only show up when using >= v2.8 of the Dart SDK.

Custom Emulators

#1553/#2360/#2319: It’s now possible to add third party emulators that don’t show up in flutter emulators to the device selector using the dart.flutterCustomEmulators setting. The emulator must still show up in flutter devices once it’s been launched for it to be used to launch an app:

"dart.flutterCustomEmulators": [
	{
		"id": "my-emu",
		"name": "My Emulator",
		"executable": "/path/to/emulator",
		"args": ["--launch"]
	}
]

This setting also allows the command/args used to launch existing Flutter emulators to be overriden by using the same ID. For example, to force an existing Android emulator with the ID Pixel_2_XL_API_29 to run with -gpu host you can override its command/args:

{
	"id": "Pixel_2_XL_API_29",
	"name": "Pixel 2",
	"executable": "/Users/danny/Library/Android/sdk/emulator/emulator",
	"args": ["-avd", "Pixel_2_XL_API_29", "-gpu", "host"]
}

Editor

Debugger

Testing

Commands

Remoting Support

Other

Fork me on GitHub