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

Settings

There are a number of settings for the Dart and Flutter extensions that can be modified in VS Code’s User Settings or Workspace Settings.

The settings described here are documented by their JSON keys, though most of them can also be edited in the settings UI in VS Code by clicking the Dart & Flutter section under Extensions.

Window Scoped Settings

Window scoped settings must be applied in your User Settings or at the workspace level and will apply for all projects open in a window (for example, dart.sdkPath is used to launch an analyzer that is used for the whole window).

Analyzer

dart.analyzerAdditionalArgs

Additional arguments to pass to the Dart Analysis Server. This setting is can be useful for troubleshooting issues with the Dart Analysis Server.

dart.analyzerSshHost

An SSH host to run the Analysis Server. This can be useful when modifying code on a remote machine using SSHFS.

dart.analyzerVmAdditionalArgs

Additional arguments to pass to the VM running the Dart Analysis Server. This setting is can be useful for troubleshooting issues with the Dart Analysis Server.

dart.analyzerVmServicePort

The port number to be used for the Dart Analysis Server VM service. This setting is intended for use by Dart Analysis Server developers.

dart.includeDependenciesInWorkspaceSymbols

Default: true.
Whether to include symbols from the SDK and package dependencies in the “Go to Symbol in Workspace” (cmd/ctrl+T) list. This can only be disabled when using Dart 3.0 / Flutter 3.10 or later.

dart.notifyAnalyzerErrors

Default: true.
Whether to show a notification the first few times an Analysis Server exception occurs.

dart.onlyAnalyzeProjectsWithOpenFiles

Default: false.
Whether to ignore workspace folders and perform analysis based on the open files, as if no workspace was open at all. This allows opening large folders without causing them to be completely analyzed.

dart.showExtensionRecommendations

Default: true.
Whether to show recommendations for other VS Code extensions based on the packages you’re using.

dart.showTodos

Default: true.
Whether to show TODOs in the Problems list. Can be a boolean to enable all TODO comments (TODO, FIXME, HACK, UNDONE) or an array of which types to enable. Older Dart SDKs may not support some TODO kinds.

DevTools

dart.closeDevTools

Options: "never", "ifOpened" or "always".
Default: "never".
Whether to automatically close embedded DevTools tabs when a debug session ends.

dart.devToolsBrowser

Options: "chrome" or "default".
Default: "chrome".
Whether to launch external DevTools windows using Chrome or the system default browser.

dart.devToolsLocation

Default: {default: beside}.
Which editor/column to open Dart DevTools pages in.

dart.devToolsPort

The port number to be used for the Dart DevTools (requires restart).

dart.devToolsReuseWindows

Default: true.
Whether to try to reuse existing DevTools windows instead of launching new ones. Only works for instances of DevTools launched by the DevTools server on the local machine.

dart.devToolsTheme

Options: "dark" or "light".
Default: "dark".
The theme to use for Dart DevTools.

dart.openDevTools

Options: "never", "flutter" or "always".
Default: "never".
Whether to automatically open DevTools at the start of a debug session. If embedded DevTools is enabled, this will launch the Widget Inspector embedded for Flutter projects, or launch DevTools externally in a browser for Dart projects.

dart.shareDevToolsWithFlutter

Default: true.
Whether to eagerly run DevTools for Flutter workspaces and share the spawned server with flutter run.

dart.showInspectorNotificationsForWidgetErrors

Default: true.
Whether to show notifications for widget errors that offer Inspect Widget links. This requires that the dart.shareDevToolsWithFlutter setting is also enabled.

Editor

dart.autoImportCompletions

Default: true.
Whether to include symbols that have not been imported in the code completion list and automatically insert the required import when selecting them (requires restart).

dart.automaticCommentSlashes

Options: "none", "tripleSlash" or "all".
Default: "tripleSlash".
Determines when to insert comment slashes when pressing <enter> in the editor (requires restart).

When using tripleSlash, double-slashes will still be included when breaking existing double-slash comments across additional lines.

dart.closingLabels

Default: true.
Whether to show annotations against constructor, method invocations and lists that span multiple lines.

dart.closingLabelsPrefix

Default: " // ".
The prefix to use in closing labels.

dart.closingLabelsTextStyle

Options: "normal" or "italic".
Default: "normal".
The text style to use in closing labels. Using Italic requires a font that supports italic text.

dart.documentation

Options: "full", "summary" or "none".
What level of documentation to show in Hovers and Code Completion details. When null, defaults to ‘full’ when running locally and ‘none’ in remote workspaces. This setting is only supported for Dart SDKs after v2.18.

dart.enableSdkFormatter

Default: true.
Whether to enable the dart_style formatter for Dart code.

dart.enableServerSnippets

Default: true.
Whether to use code snippets from the Dart Analysis Server instead of those included in the extension. Server snippets are context and language-version aware and should be preferred.

dart.enableSnippets

Default: true.
Whether to include Dart and Flutter snippets in code completion.

dart.lspSnippetTextEdits

Default: true.
Whether to enable Snippet support in LSP TextEdits.

dart.renameFilesWithClasses

Options: "never", "prompt" or "always".
Default: "never".
Whether to rename files when renaming classes with matching names (for example renaming ‘class Person’ inside ‘person.dart’). If set to ‘prompt’, will ask each time before renaming. If set to ‘always’, the file will automatically be renamed. This setting requires using LSP and a Dart SDK of at least v2.15.

dart.showDartPadSampleCodeLens

Default: true.
Whether to show CodeLens actions in the editor for opening online DartPad samples.

dart.showMainCodeLens

Default: true.
Whether to show CodeLens actions in the editor for quick running / debugging scripts with main functions.

dart.showTestCodeLens

Default: true.
Whether to show CodeLens actions in the editor for quick running / debugging tests.

dart.updateImportsOnRename

Default: true.
Whether to automatically update imports when moving or renaming files. Currently only supports single file moves / renames.

dart.warnWhenEditingFilesInPubCache

Default: true.
Whether to show a warning when modifying files in the system package cache directory.

dart.warnWhenEditingFilesOutsideWorkspace

Default: true.
Whether to show a warning when modifying files outside of the workspace.

Flutter

dart.flutterAdbConnectOnChromeOs

Default: false.
Whether to automatically run adb connect 100.115.92.2:5555 when spawning the Flutter daemon when running on Chrome OS.

dart.flutterCreateAndroidLanguage

Options: "java" or "kotlin".
Default: "kotlin".
The programming language to use for Android apps when creating new projects using the Flutter: New Project command.

dart.flutterCreateIOSLanguage

Options: "objc" or "swift".
Default: "swift".
The programming language to use for iOS apps when creating new projects using the Flutter: New Project command. This is only supported up until Flutter 3.22 after which it will be ignored.

dart.flutterCreateOrganization

The organization responsible for your new Flutter project, in reverse domain name notation (e.g. com.google). This string is used in Java package names and as prefix in the iOS bundle identifier when creating new projects using the Flutter: New Project command.

dart.flutterCreatePlatforms

The platforms to enable for new projects created using the Flutter: New Project command. If unset, all platforms will be enabled.

dart.flutterCustomEmulators

Custom emulators to show in the emulator list for easier launching. If IDs match existing emulators returned by Flutter, the custom emulators will override them.

dart.flutterGenerateLocalizationsOnSave

Options: "never", "manual", "manualIfDirty", "all" or "allIfDirty".
Default: "never".
Whether to automatically run the Generate Localizations command for Flutter apps when saving .arb files.

dart.flutterGutterIcons

Default: true.
Whether to show Flutter icons and colors in the editor gutter.

dart.flutterHotReloadOnSave

Options: "never", "manual", "manualIfDirty", "all" or "allIfDirty".
Default: "manual".
Whether to automatically send a Hot Reload request to Flutter apps during a debug session when saving files. Dart apps are controlled by the hotReloadOnSave setting.

dart.flutterOutline

Default: true.
Whether to show the Flutter Outline tree in the sidebar.

dart.flutterRememberSelectedDevice

Default: true.
Whether to remember which device was last (explicitly) selected for each project. When the remembered device is selected, it will prevent newly-connected mobile devices from being automatically selected (regardless of the dart.flutterSelectDeviceWhenConnected setting).

dart.flutterSelectDeviceWhenConnected

Default: true.
Whether to set newly connected devices as the current device in Flutter projects.

dart.flutterShowEmulators

Options: "local", "always" or "never".
Default: "local".
When to show the Flutter emulators. These are usually hidden for remote workspaces because it is usually not possible to see or interact with emulators in a remote session. If you are using remoting/containers in a way that you can interact with launched emulator processes, you may wish to set this to ‘always’.

dart.flutterShowWebServerDevice

Options: "remote" or "always".
Default: "remote".
When to show the Flutter headless web-server device. This requires using the Dart Debug extension for Chrome and is usually only used for remote environments where Chrome is not available such as browser/cloud-based IDEs (requires restart).

dart.flutterWebRenderer

Options: "flutter-default", "canvaskit", "html" or "auto".
Default: "flutter-default".
Sets the Web renderer used for Flutter web apps.

dart.hotReloadOnSave

Options: "never", "manual", "manualIfDirty", "all" or "allIfDirty".
Default: "never".
Whether to automatically send a Hot Reload request to Dart apps during a debug session when saving files. Flutter apps are controlled by the flutterHotReloadOnSave setting.

dart.offline

Default: false.
Whether to use the –offline switch for commands like pub get and Flutter: New Project.

Logging

dart.maxCompletionItems

The maximum number of completion items to return from a code completion request. Updated results will be fetched as additional characters are typed. Lower numbers may improved performance. Defaults to a lower value in remote workspaces. Only affects LSP for > Dart SDK 2.17.

dart.maxLogLineLength

Default: 2000.
The maximum length of a line in the log file. Lines longer than this will be truncated and suffixed with an ellipsis.

Pub

dart.enablePub

Default: true.
Whether to enable functionality for using Pub. Turning this setting off will prevent the extension from ever running pub and hide all commands relating to this. Use this if you are using an alternative package manager.

dart.runPubGetOnNestedProjects

Options: "none", "both", "above" or "below".
Default: "none".
Whether to automatically run pub get on nested projects above or below the one where the pubspec was changed.

Run and Debug

dart.buildRunnerAdditionalArgs

Additional args to pass to the build_runner when building/watching/serving.

dart.cliConsole

Options: "debugConsole", "terminal" or "externalTerminal".
Default: "debugConsole".
Whether to run Dart CLI apps in the Debug Console or a terminal. The Debug Console has more functionality because the process is controlled by the debug adapter, but is unable to accept input from the user via stdin.

dart.debugExtensionBackendProtocol

Options: "sse" or "ws".
Default: "ws".
The protocol to use for the Dart Debug Extension backend service and injected client. Using WebSockets can improve performance but may fail when connecting through some proxy servers.

dart.debugExternalPackageLibraries

Default: false.
Whether to mark external pub package libraries (including package:flutter) as debuggable, enabling stepping into them while debugging.

dart.debugSdkLibraries

Default: false.
Whether to mark Dart SDK libraries (dart:*) as debuggable, enabling stepping into them while debugging.

dart.evaluateToStringInDebugViews

Default: true.
Whether to call toString() on objects when rendering them in debug views (such as the Variables, Watch and Hovers views). Only applies to views of 100 or fewer values for performance reasons.

dart.hotReloadProgress

Options: "notification" or "statusBar".
Default: "notification".
Determines how to display Hot Restart and Hot Reload progress.

dart.promptToRunIfErrors

Default: true.
Whether to prompt before running if there are errors in your project. Test scripts will be excluded from the check unless they’re the script being run.

dart.showDebuggerNumbersAsHex

Default: false.
Whether to show integers formatted as Hex in Variables, Watch, Debug Consoles.

dart.showDevToolsDebugToolBarButtons

Default: true.
Whether to show DevTools buttons in the floating Debug toolbar.

SDK

dart.addSdkToTerminalPath

Default: true.
Whether to add your selected Dart/Flutter SDK path to the PATH environment variable for the embedded terminal. This is useful when switching SDKs via dart.sdkPaths / dart.flutterSdkPaths to ensure commands run from the terminal are the same version as being used by the editor/debugger (requires restart).

dart.checkForSdkUpdates

Default: true.
Whether to check you are using the latest version of the Dart SDK at startup.

dart.sdkSwitchingTarget

Options: "workspace" or "global".
Default: "workspace".
Where to save SDK selections when using fast SDK switching from the language status entry.

Testing

dart.allowTestsOutsideTestFolder

Default: false.
Whether to consider files ending _test.dart that are outside of the test directory as tests. This should be enabled if you put tests inside the lib directory of your Flutter app so they will be run with flutter test and not flutter run.

dart.openTestView

Default: [testRunStart].
When to automatically switch focus to the test list (array to support multiple values).

dart.showSkippedTests

Default: true.
Whether to show skipped tests in the test tree.

dart.testInvocationMode

Options: "name" or "line".
Default: "name".
How to identify tests when running/debugging. name is compatible with older versions of package:test but cannot handle some complex/dynamic test names. line will prefer to run tests by their line numbers (when available) and fall back to name only if the line number is unavailable.

Other

dart.env

Default: {}.
Additional environment variables to be added to all Dart/Flutter processes spawned by the Dart and Flutter extensions.

dart.projectSearchDepth

Default: 5.
How many levels (including the workspace roots) down the workspace to search for Dart/Flutter projects. Increasing this number may help detect Flutter projects that are deeply nested in your workspace but slow down all operations that search for projects, including extension activation.

Experimental

dart.experimentalRefactors

Default: false.
Whether to enable experimental (possibly unfinished or unstable) refactors on the lightbulb menu. This setting is intended for use by Dart Analysis Server developers or users that want to try out and provide feedback on in-progress refactors.

dart.normalizeFileCasing

Default: false.
Whether to normalize file casings before sending them to the LSP server. This may fix issues with file_names lints not disappearing after renaming a file if the VS Code API continues to use the original casing.

dart.previewCommitCharacters

Default: false.
EXPERIMENTAL: Whether to enable commit characters for the LSP server. In a future release, the dart.enableCompletionCommitCharacters setting will also apply to LSP.

dart.previewFlutterUiGuides

Default: false.
EXPERIMENTAL: Whether to enable the Flutter UI Guides preview.

dart.previewFlutterUiGuidesCustomTracking

Default: false.
EXPERIMENTAL: Whether to enable custom tracking of Flutter UI guidelines (to hide some latency of waiting for the next Flutter Outline).

dart.previewHotReloadOnSaveWatcher

Default: false.
Whether to perform hot reload on save based on a filesystem watcher for Dart files rather than using VS Code’s onDidSave event. This allows reloads to trigger when external tools modify Dart source files.

Legacy

dart.additionalAnalyzerFileExtensions

LEGACY SETTING: Only applies to legacy analysis server protocol.

Additional file extensions that should be analyzed (usually used in combination with analyzer plugins).

dart.analysisServerFolding

Default: true.
LEGACY SETTING: Only applies to legacy analysis server protocol.

Whether to use folding data from the Dart Analysis Server instead of the built-in VS Code indent-based folding.

dart.analyzeAngularTemplates

Default: true.
LEGACY SETTING: The angular plugin is no longer supported.

Whether to enable analysis for AngularDart templates (requires the Angular analyzer plugin to be enabled in analysis_options.yaml).

dart.updateDevTools

Default: true.
LEGACY SETTING: Only applies to Dart SDKs before v2.15 since DevTools now ships in the SDK.

Whether to update DevTools if you are not using the latest version.

dart.useLegacyAnalyzerProtocol

Default: false.
LEGACY SETTING: Only applies to Dart SDKs before v3.3 and is generally not recommended since v2.12.

Whether to use the Dart Analyzer’s original protocol instead of LSP. Some features are not supported when using the legacy protocol and support for it will eventually be removed. Please file issues on GitHub in the Dart Code repo if you find yourself needing to enable this setting.

dart.useLegacyDebugAdapters

LEGACY SETTING: Legacy debug adapters are not recommended since Dart v3.4.

Whether to use the legacy debug adapters even if the new debug adapters are available in the current Dart/Flutter SDKs contain. Setting the value to true will force use of the legacay adapters. Setting to false will force use of the SDK adapters. Leaving as null will allow the extension to decide which debug adapters to use depending on the SDK version and rollout progress.

Resource Scoped Settings

Resource scoped settings can be set in individual workspace folder settings and apply to resources within that workspace folder (for example each workspace folder could have its own dart.lineLength).

Analyzer

dart.analysisExcludedFolders

An array of paths to be excluded from Dart analysis. This option should usually be set at the Workspace level. Excluded folders will also be ignored when detecting project types.

dart.analyzerPath

The path to a custom Dart Analysis Server. This setting is intended for use by Dart Analysis Server developers.

DevTools

dart.customDevTools

Custom settings for launching DevTools. This setting is intended for use by Dart DevTools developers.

Editor

dart.completeFunctionCalls

Default: true.
Whether to insert parentheses and placeholders for positional and required arguments during code completions when using LSP. This feature is automatically disabled if commit characters are enabled.

dart.enableCompletionCommitCharacters

Default: false.
Whether to automatically commit the selected completion item when pressing certain keys such as . , ( and [. This setting does not currently apply to LSP, see dart.previewCommitCharacters.

dart.hotReloadPatterns

An array of glob patterns that should trigger Hot Reload when saved. The pattern is matched against the absolute path of the file. Use **/assets/** to trigger reloading for everything in the assets directory. Must always start with “**/” and use forward slashes (even on Windows) as backslashes are used for escaping.

dart.insertArgumentPlaceholders

Default: true.
Whether to insert argument placeholders during code completions. This feature is automatically disabled when enableCompletionCommitCharacters is enabled.

dart.lineLength

Default: 80.
The maximum length of a line of code. This is used by the document formatter. If you change this value, you may wish to update editor.rulers (which draws vertical lines in the editor) in the ["dart"] section if your settings to match.

Flutter

dart.flutterAdditionalArgs

Additional args to pass to all flutter commands including flutter daemon. Do not use this to pass arguments to your Flutter app, use the args field in a launch.json or the dart.flutterRunAdditionalArgs setting.

dart.flutterAttachAdditionalArgs

Additional args to pass to the flutter attach command. Using the args/toolArgs fields in launch.json is usually better than this setting as this setting will apply to all projects.

dart.flutterRunAdditionalArgs

Additional args to pass to the flutter run command. Using the args/toolArgs fields in launch.json is usually better than this setting as this setting will apply to all projects.

dart.flutterScreenshotPath

The path to a directory to save Flutter screenshots.

dart.flutterTestAdditionalArgs

Additional args to pass to the flutter test command. Using the args/toolArgs fields in launch.json is usually better than this setting as this setting will apply to all projects.

Custom Color Settings

Some colors in Dart Code can be customized using the workbench.colorCustomizations section in settings. Supported colors are:

dart.closingLabels

The color of the ‘closing label’ annotations shown against constructor, method invocations and lists that span multiple lines. If not supplied, the color for tab.inactiveForeground will be used.

dart.flutterUiGuides

The color of the Flutter UI Guidelines shown in the editor.

Diagnostic Settings

There are several settings for enabling logging of various services used by Dart Code. For more information about setting these up and troubleshooting please see Enabling Logging.

Analyzer

dart.analyzerDiagnosticsPort

The port number to be used for the Dart analyzer diagnostic server. This setting is can be useful for troubleshooting issues with the Dart Analysis Server.