Dart: Add Dependency Improvements
#3811: It’s now possible to add multiple dependencies in one step using Dart: Add Dependency using commas between package names.
Flutter
- #3998: New icons added in Flutter 3.0 (such as
solar_power
, safety_check
) now have previews in hovers/completion. - #3997:
CupertinoIcons.location
no longer shows the wrong icon preview in hovers/completion. - #3949: A new Flutter task/command (Flutter: Generate Localizations) has been added (including in context menus/title bar for
.arb
files) that runs flutter gen-l10n
. - #3961: Support for initializing the Flutter SDK when installed by a package manager has been generalised to support package managers other than Snap (such as Hermit).
- #3968: The
dart.flutterShowEmulators
setting now has an additional value "never"
which always hides emulators from device selection picklists. - #3971/#3965: @nilsreichardt contributed a fix to move the call to
super.dispose()
to the end of the dispose()
method in the stanim
snippet. Note: When snippets are being provided by the language server, the dispose()
call will still be at the start of the method until the next Dart/Flutter SDK releases.
Editor
- #3782: Documentation in hovers and code completion can now render basic HTML tags like
<b>
, <i>
, <blockquote>
. - #3989: File nesting patterns have been added to nest several generated files like
pubspec.lock
and .packages
under the pubspec.yaml
file and foo.g.dart
under foo.dart
. File nesting can be enabled using the explorer.fileNesting.enabled
setting (and default state with the explorer.fileNesting.expand
setting). - #3995: The
dart.hotReloadOnSave
and dart.flutterHotReloadOnSave
settings have been updated to include new values "manualIfDirty"
and "allIfDirty"
that will trigger hot-reload-on-save only if the saved file(s) are dirty. The default value remains "manual"
to better support auto-save. The "always"
setting has been renamed to "all"
. - #3996: Code Actions that generate code with suggested names (such as Assign value to new local variable) no longer insert snippet markup text into the file.
- #3969: Snippets like
for
no longer fail to appear in apps with large dependencies (including Flutter apps). - #3954: When using Dart 2.17/Flutter 3.0 with LSP disabled, snippets will no longer fail to show up.
- #3946: If a language server request fails, the Output pane will no longer be automatically focused before clicking the “Go to Output” button.
Testing
- #3963: Improvements have been made to the recording of test messages that show up in the Test Error Peek window for failed tests. The final failure message should now show up instead of a generic “The test failed” message.
DevTools
- #3967: Using the
dart.devToolsLogFile
setting to log communication with the DevTools server no longer fails to record any traffic.
Docs / Website
- #3994: Descriptions on the
dart.sdkPath
and dart.sdkPaths
settings (and equivalent Flutter settings) have been improved tp make it clearer that the sdkPaths
settings are used only for SDK switching and not for initial SDK searching. - #3824: Docs now contain additional examples for how to configured launch configurations for Dart (non-Flutter) web apps.
Features/Fixes Enabled with Flutter 3.0/Dart 2.17
A number of features/fixes noted from in previous release notes that relied on an updated Dart/Flutter SDK are now available to stable channel users that have upgraded to Flutter 3.0/Dart 2.17, including:
- #3873: Code completion for zero-argument functions no longer places the cursor inside the parens.
- #3872: The Extract Method code action will now check the extraction is valid before prompting for a method name.
- #3869: Some code actions like Surround with if now have improved snippet support and will provide better selections after inserting code.
- #3867: Holding
ctrl
when hovering over paths to examples in Flutter dartdocs will no longer highlight significantly more of the file than included in the path. - #3864: “A request has failed” errors will no longer appear if you navigate to files that reference Flutter colors that are outside of the workspace (such as Flutter SDK sources or Pub package sources).
- #3846: The “Convert Getter to Method” assist now works for extensions.
- #3844: Code completion no longer inserts unwanted commas when editing argument names.
- #3823: A new “Convert to ‘package:’ import for everywhere in file” fix is available when using the
always_use_package_imports
lint. - #2492: The “Wrap with Column” refactor is now available when a Widget constructor is selected and not only when there is no selection.
- #3830: The “Invalid file path” message sometimes shown when analysis fails will be more specific rather than a catch-all for several types of failure.
- #3783: Code completion no longer activates while typing in standard double-slash comments that are immediately before a dartdoc triple-slash comment.
- #3778: A new
"instance"
semantic token modifier has been added to instance members, allowing them to be themed/colored separately to other symbols. - #3770: The Create Method ‘xxx’ fix now includes the
required
keyword for required named arguments if the library is null-safe. - #1160: Hover tooltips now include the static type of a variable, which may be different to the declared type (for example if the variable is used in an
is
check). - #3784: Code completion should now include members that can be overridden more reliably.
- #3440: New packages added to
pubspec.yaml
should now be available more reliably after saving and waiting for the *pub get
command to complete. - #3438: Fetching packages in a Flutter project should no longer intermittently result in the
flutter_gen
package failing to resolve.
Features/Fixes Enabled with Future SDKs
These items rely on changes to the Dart/Flutter SDKs that have not yet been released to stable channels. They will show up automatically when you update your SDK in future (or if using beta/development channels depending on the exact version).
- #3952: Using
source.fixAll
in editor.codeActionsOnSave
is no longer very slow (despite the command being very fast when run on its own). - #3975: Flutter Widget snippets now include
return Container()
as a placeholder build
method. - #3981: “Add curly braces” now shows as a Quick-fix for the
always_put_control_body_on_new_line
lint. - #3970: Ctrl+Click/Go-to-Definition now works on filenames in “part of” directives.