Original link: medium.com/dartlang/da…

Dart 2.16 is officially released today following Flutter 2.10, which contains no new language features, but a bunch of bug fixes (including fixes for security vulnerabilities), improved support for the Dart package on specific platforms, and a new search experience for Pub.dev.

The Dart 2.16

Dart 2.16 SDK, released today with Flutter 2.10, continues the transition from traditional Dart CLI tools (DarTFMT, DartDoc, etc.) to new combined Dart development tools, The new deprecated tools are Dart Doc (Use Dart Doc) and Dart Analyzer (Use Dart Analyze).

In Dart 2.17 we plan to completely remove Dart Doc, Dart Analyzer, and pub commands (deprecated in Dart 2.15; Dart pub or Flutter pub). See #46100 for more information.

Version 2.16 also includes a security bug fix and two minor major changes:

  • Dart: The HttpClient API in IO allows optional headers for authorization, wwf-Authenticate, cookie and Cookie2. There was a bug in the implementation of the redirection logic in the SDK prior to DART 2.16. These headers (which may contain sensitive information) are passed on when a cross-domain redirect occurs and are removed in Dart 2.16.

  • The directory.rename API in DART: IO has changed its behavior on Windows: It no longer deletes existing directories that match the target name (#47653).

  • Platform.packageRoot and Isolate. PackageRoot apis — left over from Dart 1.x and not working in Dart 2.x, have been removed (Issue # 47769).

For more detailed information on changes to Dart 2.16, see the Change log: github.com/dart-lang/s…

New platform statement support for pub.dev package

Dart itself is designed to be portable, and we try to make the code run on more platforms, but sometimes you might create and share packages on pub.dev that are designed for one or more platforms, and you might have a package that relies on apis that are only available on a particular operating system, Or a package that uses dart: FFI libraries that are supported only on Native platforms, not the Web.

With Dart 2.16, you can now manually declare the supported platform set in the package’s Pubspec. For example, if your package only supports Windows and macOS, its pubspec.yaml file might look like this:

Name: mypackage version: 1.0.0platforms: Windows: macos: Dependencies:Copy the code

The new Platforms TAB is applicable if you are developing a Dart package, and the Flutter plugin TAB usually specifies the supported platform if you are developing and sharing a Flutter plugin that contains host-specific code (such as Kotlin or Swift).

New pub.dev search UI

In response to developers’ requests for better support for searching packages on pub.dev, the main goal of the changes released today is to help developers better identify and search the set of supported platforms. Here is a view of the new search experience:

The new search UI has a search filter sidebar on the left that you can use to limit your package search:

  • Platforms: Select one or more Platforms to narrow the search results to packages that support only all Platforms of your choice.
  • SDKs: Select Dart or Flutter to limit the result to packages that support Dart SDK or Flutter SDK, respectively.
  • Advanced: Additional search options, such as filtering to the Flutter Favorite package.

Air security update

Several versions have been released since we last discussed NULL security, a major language addition that was introduced in Dart 2.12 a year ago.

We were surprised at the speed with which the Dart ecosystem migration package supported NULL security:

As of today, 100% of the first 250 packs are supported and 96% of the first 1000 packs are supported! Thanks to all the package writers who contributed to this great achievement.

We have also seen good progress in migrating applications to robust null security. According to our analysis, 71% of all running sessions in the Flutter tool now have fully reliable NULL security. If you are an application developer but have not yet migrated to NULL security, now is a good time.

The end of the review

We hope the new Pub.dev search UI will be useful to you, and we welcome any feedback. Stay tuned for the next Dart SDK release planned for q2 2022, and we’re working on some exciting language features that we hope to release later this year.

Github.com/dart-lang/l…