From f5e59f8a040a381fffa0f8c5dd3e4281fb828d9a Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Fri, 9 Jul 2021 01:34:24 +0000 Subject: [PATCH] Cleanup and standardize format of changelog Using https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode Change-Id: I6a9dca93d8852a606b143394318691de9890b9a3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206302 Auto-Submit: Kevin Moore Reviewed-by: Bob Nystrom Commit-Queue: Kevin Moore --- CHANGELOG.md | 6236 +++++++++++++++++++++++++------------------------- 1 file changed, 3135 insertions(+), 3101 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04485aa6b14..07b09a77030 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,74 +4,73 @@ #### `dart:async` -* The uncaught error handlers of `Zone`s are now run in the parent zone - of the zone where they were declared. This prevents a throwing handler - from causing an infinite loop by repeatedly triggering itself. +- The uncaught error handlers of `Zone`s are now run in the parent zone of the + zone where they were declared. This prevents a throwing handler from causing + an infinite loop by repeatedly triggering itself. -* Added `ignore()` as extension member on futures. +- Added `ignore()` as extension member on futures. -* Added `void unawaited(Future)` top-level function to deal with - the `unawaited_futures` lint. +- Added `void unawaited(Future)` top-level function to deal with the + `unawaited_futures` lint. #### `dart:core` -* Introduce `Enum` interface implemented by all `enum` declarations. +- Introduce `Enum` interface implemented by all `enum` declarations. -* The native `DateTime` class now better handles local time around - daylight saving changes that are not precisely one hour. - (No change on the Web which uses the JavaScript `Date` object.) +- The native `DateTime` class now better handles local time around daylight + saving changes that are not precisely one hour. (No change on the Web which + uses the JavaScript `Date` object.) -* Adds static methods `hash`, `hashAll` and `hashAllUnordered` to the - `Object` class. These can be used to combine the hash codes of - multiple objects in a consistent way. - -* The `Symbol` constructor now accepts any string as argument. - Symbols are equal if they were created from the same string. +- Adds static methods `hash`, `hashAll` and `hashAllUnordered` to the `Object` + class. These can be used to combine the hash codes of multiple objects in a + consistent way. +- The `Symbol` constructor now accepts any string as argument. Symbols are equal + if they were created from the same string. #### `dart:ffi` -* Adds the `DynamicLibrary.providesSymbol` function to check whether a symbol - is available in a dynamic library. +- Adds the `DynamicLibrary.providesSymbol` function to check whether a symbol is + available in a dynamic library. #### `dart:html` -* `convertNativeToDart_Dictionary()` now converts objects - recursively, this fixes APIs like MediaStreamTrack.getCapabilities - that convert between Maps and browser Dictionaries. [#44319] +- `convertNativeToDart_Dictionary()` now converts objects recursively, this + fixes APIs like MediaStreamTrack.getCapabilities that convert between Maps and + browser Dictionaries. [#44319] [#44319]: https://github.com/dart-lang/sdk/issues/44319 #### `dart:io` -* BREAKING CHANGE (for pre-migrated null safe code): - `HttpClient`'s `.authenticate` and `.authenticateProxy` setter callbacks - must now accept a nullable `realm` argument. +- BREAKING CHANGE (for pre-migrated null safe code): `HttpClient`'s + `.authenticate` and `.authenticateProxy` setter callbacks must now accept a + nullable `realm` argument. #### `dart:typed_data` -* **BREAKING CHANGE** (https://github.com/dart-lang/sdk/issues/45115) - Most types exposed by this library can no longer be extended, implemented - or mixed-in. The affected types are `ByteBuffer`, `TypedData` and *all* - its subclasses, `Int32x4`, `Float32x4`, `Float64x2` and `Endian`. +- **BREAKING CHANGE** (https://github.com/dart-lang/sdk/issues/45115) Most types + exposed by this library can no longer be extended, implemented or mixed-in. + The affected types are `ByteBuffer`, `TypedData` and _all_ its subclasses, + `Int32x4`, `Float32x4`, `Float64x2` and `Endian`. #### `dart:web_sql` -* `dart:web_sql` is marked deprecated and will be removed in an upcoming - release. Also the API `window.openDatabase` in `dart:html` is deprecated as - well. +- `dart:web_sql` is marked deprecated and will be removed in an upcoming + release. Also the API `window.openDatabase` in `dart:html` is deprecated as + well. - This API and library was exposing the WebSQL proposed standard. The standard - was abandoned more than 5 years ago and is not supported by most browsers. - The `dart:web_sql` library has been documented as unsupported and deprecated - for many years as well and but wasn't annotated properly until now. + This API and library was exposing the WebSQL proposed standard. The standard + was abandoned more than 5 years ago and is not supported by most browsers. The + `dart:web_sql` library has been documented as unsupported and deprecated for + many years as well and but wasn't annotated properly until now. ### Dart VM -* **Breaking Change** [#45071][]: `Dart_NewWeakPersistentHandle`'s and - `Dart_NewFinalizableHandle`'s `object` parameter no longer accepts - `Pointer`s and subtypes of `Struct`. Expandos no longer accept - `Pointer`s and subtypes of `Struct`s. +- **Breaking Change** [#45071][]: `Dart_NewWeakPersistentHandle`'s and + `Dart_NewFinalizableHandle`'s `object` parameter no longer accepts `Pointer`s + and subtypes of `Struct`. Expandos no longer accept `Pointer`s and subtypes of + `Struct`s. [#45071]: https://github.com/dart-lang/sdk/issues/45071 @@ -79,31 +78,32 @@ #### Dart command line -* **Breaking Change** [#46100][]: The standalone `dart2native` tool has been - marked deprecated, and now prints a warning message. Its replacements are - the `dart compile exe` and `dart compile aot-snapshot` commands, which offer - the same functionality. The `dart2native` tool will be removed from the Dart - SDK in Dart 2.15. +- **Breaking Change** [#46100][]: The standalone `dart2native` tool has been + marked deprecated, and now prints a warning message. Its replacements are the + `dart compile exe` and `dart compile aot-snapshot` commands, which offer the + same functionality. The `dart2native` tool will be removed from the Dart SDK + in Dart 2.15. -* **Breaking Change**: The standalone `dartfmt` tool has been marked - deprecated, and now prints a warning message. Instead, use `dart format`. - The `dartfmt` tool will be removed from the Dart SDK in Dart 2.15. +- **Breaking Change**: The standalone `dartfmt` tool has been marked deprecated, + and now prints a warning message. Instead, use `dart format`. The `dartfmt` + tool will be removed from the Dart SDK in Dart 2.15. - Note that `dart format` has [a different set of options and - defaults][dartfmt cli] than `dartfmt`. + Note that `dart format` has [a different set of options and + defaults][dartfmt cli] than `dartfmt`. -* The `dart create` command has been updated to create projects that use the - new 'recommended' set of lints from `package:lints`. See - https://dart.dev/go/core-lints for more information about these lints. +- The `dart create` command has been updated to create projects that use the new + 'recommended' set of lints from `package:lints`. See + https://dart.dev/go/core-lints for more information about these lints. [#46100]: https://github.com/dart-lang/sdk/issues/46100 [dartfmt cli]: https://github.com/dart-lang/dart_style/wiki/CLI-Changes -* The `dart analyze` command has been extended to support specifying multiple - files or directories to analyze; see also https://github.com/dart-lang/sdk/issues/45352. +- The `dart analyze` command has been extended to support specifying multiple + files or directories to analyze; see also + https://github.com/dart-lang/sdk/issues/45352. -* The `dartanalyzer` command's JSON output mode has been changed to emit the JSON - output on stdout instead of stderr. +- The `dartanalyzer` command's JSON output mode has been changed to emit the + JSON output on stdout instead of stderr. #### dart format @@ -118,30 +118,28 @@ Updated the Linter to `1.7.0`, which includes changes that - fix case-sensitive false positive in `use_full_hex_values_for_flutter_colors`. -- improve try-block and switch statement flow analysis for +- improve try-block and switch statement flow analysis for `use_build_context_synchronously`. -- update `use_setters_to_change_properties` to only highlight a method name, - not the entire body and doc comment. +- update `use_setters_to_change_properties` to only highlight a method name, not + the entire body and doc comment. - update `unnecessary_getters_setters` to allow otherwise "unnecessary" getters and setters with annotations. - update `missing_whitespace_between_adjacent_strings` to allow String interpolations at the beginning and end of String literals. - update `unnecessary_getters_setters` to allow for setters with non-basic assignments (for example, `??=` or `+=`). -- relax `non_constant_identifier_names` to allow for a trailing - underscore. -- fix false negative in `prefer_final_parameters` where first parameter - is final. +- relax `non_constant_identifier_names` to allow for a trailing underscore. +- fix false negative in `prefer_final_parameters` where first parameter is + final. - improve `directives_ordering` sorting of directives with dot paths and dot-separated package names. - (internal) migrate to `SecurityLintCode` instead of deprecated `SecurityLintCodeWithUniqueName`. - (internal) fix `avoid_types_as_parameter_names` to skip field formal parameters. -- fix false positives in `prefer_interpolation_to_compose_strings` where - the left operand is not a String. -- fix false positives in `only_throw_errors` for misidentified type - variables. +- fix false positives in `prefer_interpolation_to_compose_strings` where the + left operand is not a String. +- fix false positives in `only_throw_errors` for misidentified type variables. - add new lint: `depend_on_referenced_packages`. - update `avoid_returning_null_for_future` to skip checks for null-safe libraries. @@ -162,87 +160,86 @@ Updated the Linter to `1.7.0`, which includes changes that #### Pub -* `dart pub publish` now respects `.pubignore` files with gitignore-style rules. - `.gitignore` files in the repo are still respected if they are not - overridden by a `.pubignore` in the same directory. +- `dart pub publish` now respects `.pubignore` files with gitignore-style rules. + `.gitignore` files in the repo are still respected if they are not overridden + by a `.pubignore` in the same directory. pub no longer queries git for listing the files. This implies: - * Checked in files will now be ignored if they are included by a `.gitignore` + + - Checked in files will now be ignored if they are included by a `.gitignore` rule. - * Global ignores are no longer taken into account. - * Even packages that are not in git source control will have their + - Global ignores are no longer taken into account. + - Even packages that are not in git source control will have their `.gitignore` files respected. - * `.gitignore` and `.pubignore` is always case-insensitive on MacOs and + - `.gitignore` and `.pubignore` is always case-insensitive on MacOs and Windows (as is default for `git` repositories). -* New flag `dart pub deps --json` gives a machine parsable overview of the +- New flag `dart pub deps --json` gives a machine parsable overview of the current dependencies. -* New command: `dart pub cache clean`. Will delete everything in your current +- New command: `dart pub cache clean`. Will delete everything in your current pub cache. -* Commands related to a single package now takes a `--directory` option to +- Commands related to a single package now takes a `--directory` option to operate on a package in the given directory instead of the working directory. -* git dependencies with a relative repo url would previously be interpreted +- git dependencies with a relative repo url would previously be interpreted relative to the current package, even for transitive dependencies. This now fails instead. -* Pub now uses a Dart library to read and write tar files. - This should fix several issues we had with incompatibilities between different - system `tar`s. -* `PUB_HOSTED_URL` can now include a trailing slash. -* Incremental compilation is now used for compilation of executables from +- Pub now uses a Dart library to read and write tar files. This should fix + several issues we had with incompatibilities between different system `tar`s. +- `PUB_HOSTED_URL` can now include a trailing slash. +- Incremental compilation is now used for compilation of executables from dependencies when using `dart run :`. ### Language -* Add an unsigned shift right operator `>>>`. Pad with zeroes, ignoring the - sign bit. On the web platform `int.>>>` shifts the low 32 bits interpreted - as an unsigned integer, so `a >>> b` gives the same result as - `a.toUnsigned(32) >>> b` on the VM. +- Add an unsigned shift right operator `>>>`. Pad with zeroes, ignoring the sign + bit. On the web platform `int.>>>` shifts the low 32 bits interpreted as an + unsigned integer, so `a >>> b` gives the same result as + `a.toUnsigned(32) >>> b` on the VM. -* Prior to Dart 2.14, metadata (annotations) were not permitted to be - specified with generic type arguments. This restriction is lifted in Dart - Dart 2.14. +- Prior to Dart 2.14, metadata (annotations) were not permitted to be specified + with generic type arguments. This restriction is lifted in Dart Dart 2.14. - ```dart - class C { - const C(); - } - @C(); // Previously permitted. - @C(); // Previously an error, now permitted. - ``` + ```dart + class C { + const C(); + } + @C(); // Previously permitted. + @C(); // Previously an error, now permitted. + ``` -* Prior to Dart 2.14, generic function types were not permitted as arguments - to generic classes or functions, nor to be used as generic bounds. This - restriction is lifted in Dart 2.14. +- Prior to Dart 2.14, generic function types were not permitted as arguments to + generic classes or functions, nor to be used as generic bounds. This + restriction is lifted in Dart 2.14. - ```dart - T wrapWithLogging(T f) { - if (f is void Function(T x)) { - return (S x) { - print("Call: f<$S>($x)"); - var r = f(x); - print("Return: $x"); - return r; - } as T; - } // More cases here - return f; - } - void foo(T x) { - print("Foo!"); - } - void main() { - // Previously an error, now permitted. - var f = wrapWithLogging(T)>(foo); - f(3); - } - ``` + ```dart + T wrapWithLogging(T f) { + if (f is void Function(T x)) { + return (S x) { + print("Call: f<$S>($x)"); + var r = f(x); + print("Return: $x"); + return r; + } as T; + } // More cases here + return f; + } + void foo(T x) { + print("Foo!"); + } + void main() { + // Previously an error, now permitted. + var f = wrapWithLogging(T)>(foo); + f(3); + } + ``` ## 2.13.4 - 2021-06-28 This is a patch release that fixes: -* a Dart VM compiler crash (issue [flutter/flutter#84212][]). -* a DDC compiler crash (issue [flutter/flutter#82838][]). +- a Dart VM compiler crash (issue [flutter/flutter#84212][]). +- a DDC compiler crash (issue [flutter/flutter#82838][]). [flutter/flutter#84212]: https://github.com/flutter/flutter/issues/84212 [flutter/flutter#82838]: https://github.com/flutter/flutter/issues/82838 @@ -251,10 +248,10 @@ This is a patch release that fixes: This is a patch release that fixes: -* a Dart compiler crash (issue [flutter/flutter#83094][]). -* an analysis server deadlock causing it to stop responding to IDE requests +- a Dart compiler crash (issue [flutter/flutter#83094][]). +- an analysis server deadlock causing it to stop responding to IDE requests (issue [#45996][]). -* an analyzer crash when analyzing against `package:meta` `v1.4.0` (issue +- an analyzer crash when analyzing against `package:meta` `v1.4.0` (issue [#46183][]). [flutter/flutter#83094]: https://github.com/flutter/flutter/issues/83094 @@ -265,8 +262,8 @@ This is a patch release that fixes: This is a patch release that fixes: -* incorrect behavior in CastMap (issue [#45473][]). -* missing nullability from recursive type hierarchies in DDC (issue [#45767][]). +- incorrect behavior in CastMap (issue [#45473][]). +- missing nullability from recursive type hierarchies in DDC (issue [#45767][]). [#45473]: https://github.com/dart-lang/sdk/issues/45473 [#45767]: https://github.com/dart-lang/sdk/issues/45767 @@ -275,64 +272,65 @@ This is a patch release that fixes: ### Language -* **Type aliases** [Non-function type aliases][]: Type aliases (names for - types introduced via the `typedef` keyword) were previously restricted - to only introduce names for function types. In this release, we - remove this restriction and allow type aliases to name any kind of type. +- **Type aliases** [Non-function type aliases][]: Type aliases (names for types + introduced via the `typedef` keyword) were previously restricted to only + introduce names for function types. In this release, we remove this + restriction and allow type aliases to name any kind of type. - ```dart - import 'dart:convert'; + ```dart + import 'dart:convert'; - typedef JsonMap = Map; + typedef JsonMap = Map; - JsonMap parseJsonMap(String input) => json.decode(input) as JsonMap; - ``` + JsonMap parseJsonMap(String input) => json.decode(input) as JsonMap; + ``` - In addition to being usable as type annotations, type aliases that name - class types can now also be used anywhere that the underlying class could be - used, allowing type aliases to be used to safely rename existing classes. + In addition to being usable as type annotations, type aliases that name class + types can now also be used anywhere that the underlying class could be used, + allowing type aliases to be used to safely rename existing classes. - ```dart - class NewClassName { - NewClassName.create(T x); - static NewClassName mkOne(T x) => NewClassName.create(x); - } - @Deprecated("Use NewClassName instead") - typedef OldClassName = NewClassName; + ```dart + class NewClassName { + NewClassName.create(T x); + static NewClassName mkOne(T x) => NewClassName.create(x); + } + @Deprecated("Use NewClassName instead") + typedef OldClassName = NewClassName; - class LegacyClass extends OldClassName { - LegacyClass() : super.create(3); - } - OldClassName legacyCode() { - var one = OldClassName.create(1); - var two = OldClassName.mkOne(2); - return LegacyClass(); - } - ``` + class LegacyClass extends OldClassName { + LegacyClass() : super.create(3); + } + OldClassName legacyCode() { + var one = OldClassName.create(1); + var two = OldClassName.mkOne(2); + return LegacyClass(); + } + ``` - The new type alias feature is only available as part of the 2.13 [language - version](https://dart.dev/guides/language/evolution). To use this feature, - you must set the lower bound on the sdk constraint for your package to 2.13 - or greater. + The new type alias feature is only available as part of the 2.13 + [language version](https://dart.dev/guides/language/evolution). To use this + feature, you must set the lower bound on the sdk constraint for your package + to 2.13 or greater. - [Non-function type aliases]: https://github.com/dart-lang/language/blob/master/accepted/2.13/nonfunction-type-aliases/feature-specification.md + [non-function type aliases]: + https://github.com/dart-lang/language/blob/master/accepted/2.13/nonfunction-type-aliases/feature-specification.md ### Core libraries #### `dart:collection` -* The `SplayTreeMap` was changed to allow `null` as key if the `compare` - function allows it. It now checks that a new key can be used as an argument - to the `compare` function when the member is added, *even if the map is - empty* (in which case it just compares the key to itself). +- The `SplayTreeMap` was changed to allow `null` as key if the `compare` + function allows it. It now checks that a new key can be used as an argument to + the `compare` function when the member is added, _even if the map is empty_ + (in which case it just compares the key to itself). -* The `SplayTreeSet` was changed to checks that a new element can be used as - an argument to the `compare` function when the member is added, *even if the - set is empty* (in which case it just compares the element to itself). +- The `SplayTreeSet` was changed to checks that a new element can be used as an + argument to the `compare` function when the member is added, _even if the set + is empty_ (in which case it just compares the element to itself). #### `dart:developer` -* Added `serverWebSocketUri` property to `ServiceProtocolInfo`. +- Added `serverWebSocketUri` property to `ServiceProtocolInfo`. ### Dart VM @@ -340,52 +338,51 @@ This is a patch release that fixes: #### Analyzer -* Static analyses with "error" severity can once again be ignored with - comments like `// ignore: code` and `// ignore_for_file: code`. To declare - that certain analysis codes, or codes with certain severities ("error", - "warning", and "info") cannot be ignored with such comments, list them in - `analysis_options.yaml`, under the `analyzer` heading, with a new YAML key, - `cannot-ignore`. For example, to declare that "error" codes and - `unused_import` cannot be ignored, write the following into - `analysis_options.yaml`: +- Static analyses with "error" severity can once again be ignored with comments + like `// ignore: code` and `// ignore_for_file: code`. To declare that certain + analysis codes, or codes with certain severities ("error", "warning", and + "info") cannot be ignored with such comments, list them in + `analysis_options.yaml`, under the `analyzer` heading, with a new YAML key, + `cannot-ignore`. For example, to declare that "error" codes and + `unused_import` cannot be ignored, write the following into + `analysis_options.yaml`: - ```yaml - analyzer: - cannot-ignore: - - error - - unused_import - ``` + ```yaml + analyzer: + cannot-ignore: + - error + - unused_import + ``` #### dart format -* Correct constructor initializer indentation after `required` named - parameters. +- Correct constructor initializer indentation after `required` named parameters. #### Linter Updated the Linter to `1.2.1`, which includes: -* Improved `iterable_contains_unrelated_type` to better support `List` content - checks. -* Fixed `camel_case_types` and `prefer_mixin` to support non-function type - aliases. -* Fixed `prefer_mixin` to properly make exceptions for `dart.collection` - legacy mixins. -* Added new lints `avoid_multiple_declarations_per_line`, - `use_if_null_to_convert_nulls_to_bools`, `deprecated_consistency`, - `use_named_constants`, `use_build_context_synchronously` (experimental). -* Deprecated `avoid_as`. -* Migrated library to null-safety. +- Improved `iterable_contains_unrelated_type` to better support `List` content + checks. +- Fixed `camel_case_types` and `prefer_mixin` to support non-function type + aliases. +- Fixed `prefer_mixin` to properly make exceptions for `dart.collection` legacy + mixins. +- Added new lints `avoid_multiple_declarations_per_line`, + `use_if_null_to_convert_nulls_to_bools`, `deprecated_consistency`, + `use_named_constants`, `use_build_context_synchronously` (experimental). +- Deprecated `avoid_as`. +- Migrated library to null-safety. ### Other libraries #### `package:js` -* **Breaking change:** It is no longer valid to use `String`s that match - an `@Native` annotation in an `@JS()` annotation for a non-anonymous JS - interop class. This led to erroneous behavior due to the way interceptors - work. If you need to work with a native class, prefer `dart:html`, an - `@anonymous` class, or `js_util`. See issue [#44211][] for more details. +- **Breaking change:** It is no longer valid to use `String`s that match an + `@Native` annotation in an `@JS()` annotation for a non-anonymous JS interop + class. This led to erroneous behavior due to the way interceptors work. If you + need to work with a native class, prefer `dart:html`, an `@anonymous` class, + or `js_util`. See issue [#44211][] for more details. [#44211]: https://github.com/dart-lang/sdk/issues/44211 @@ -398,12 +395,13 @@ initializers containing async closures (issue [#45306][]). ## 2.12.3 - 2021-04-14 -This is a patch release that fixes a vulnerability in `dart:html` related to -DOM clobbering. See the [vulnerability advisory][CVE-2021-22540] for more -details. Thanks again to **Vincenzo di Cicco** for finding and reporting this +This is a patch release that fixes a vulnerability in `dart:html` related to DOM +clobbering. See the [vulnerability advisory][cve-2021-22540] for more details. +Thanks again to **Vincenzo di Cicco** for finding and reporting this vulnerability. -[CVE-2021-22540]: https://github.com/dart-lang/sdk/security/advisories/GHSA-3rfv-4jvg-9522 +[cve-2021-22540]: + https://github.com/dart-lang/sdk/security/advisories/GHSA-3rfv-4jvg-9522 ## 2.12.2 - 2021-03-17 @@ -416,8 +414,8 @@ This is a patch release that fixes crashes reported by Flutter 2 users (issue This is a patch release that fixes: -* an unhandled exception in HTTPS connections (issue [#45047][]). -* a typing issue in the typed_data `+` operator (issue [#45140][]). +- an unhandled exception in HTTPS connections (issue [#45047][]). +- a typing issue in the typed_data `+` operator (issue [#45140][]). [#45047]: https://github.com/dart-lang/sdk/issues/45047 [#45140]: https://github.com/dart-lang/sdk/issues/45140 @@ -426,297 +424,294 @@ This is a patch release that fixes: ### Language -* **Breaking Change** [Null safety][] is now enabled by default in all code - that has not opted out. With null safety, types in your code are - non-nullable by default. Null can only flow into parts of your program where - you want it. With null safety, your runtime null-dereference bugs turn into - edit-time analysis errors. +- **Breaking Change** [Null safety][] is now enabled by default in all code that + has not opted out. With null safety, types in your code are non-nullable by + default. Null can only flow into parts of your program where you want it. With + null safety, your runtime null-dereference bugs turn into edit-time analysis + errors. - You can opt out of null safety and preserve your code's previous behavior by - setting the lower bound of the SDK constraint in your pubspec to 2.11.0 or - earlier to request an earlier [language version][]. You can opt out - individual Dart files by adding `// @dart=2.11` to the beginning of the - file. + You can opt out of null safety and preserve your code's previous behavior by + setting the lower bound of the SDK constraint in your pubspec to 2.11.0 or + earlier to request an earlier [language version][]. You can opt out individual + Dart files by adding `// @dart=2.11` to the beginning of the file. - Files that are opted in to null safety may report new compile-time errors. - Opting in to null safety also gives you access to other new language - features: + Files that are opted in to null safety may report new compile-time errors. + Opting in to null safety also gives you access to other new language features: - * Smarter flow analysis and type promotion - * `required` named parameters - * `late` variables - * The postfix `!` null assertion operator - * The `?..` and `?[]` null-aware operators + - Smarter flow analysis and type promotion + - `required` named parameters + - `late` variables + - The postfix `!` null assertion operator + - The `?..` and `?[]` null-aware operators -* **Breaking Change** [#44660][]: Fixed an implementation bug where `this` - would sometimes undergo type promotion in extensions. +- **Breaking Change** [#44660][]: Fixed an implementation bug where `this` would + sometimes undergo type promotion in extensions. [null safety]: https://dart.dev/null-safety/understanding-null-safety -[language version]: https://dart.dev/guides/language/evolution#language-versioning +[language version]: + https://dart.dev/guides/language/evolution#language-versioning [#44660]: https://github.com/dart-lang/sdk/issues/44660 ### Core libraries #### `dart:async` -* Add extension method `onError()` on `Future` to allow better typing of error - callbacks. +- Add extension method `onError()` on `Future` to allow better typing of error + callbacks. #### `dart:collection` -* Add `UnmodifiableSetView` class, which allows users to guarantee that - methods that could change underlying `Set` instance can not be invoked. +- Add `UnmodifiableSetView` class, which allows users to guarantee that methods + that could change underlying `Set` instance can not be invoked. -* Make it explicit that `LinkedList` compares elements by identity, and update - `contains()` to take advantage of this. +- Make it explicit that `LinkedList` compares elements by identity, and update + `contains()` to take advantage of this. #### `dart:core` -* Add `Set.unmodifiable()` constructor, which allows users to create - unmodifiable `Set` instances. +- Add `Set.unmodifiable()` constructor, which allows users to create + unmodifiable `Set` instances. #### `dart:io` -* `HttpRequest` now correctly follows HTTP 308 redirects - (`HttpStatus.permanentRedirect`). +- `HttpRequest` now correctly follows HTTP 308 redirects + (`HttpStatus.permanentRedirect`). #### `dart:isolate` -* Add `debugName` positional parameter to `ReceivePort` and `RawReceivePort` - constructors, a name which can be associated with the port and displayed in - tooling. +- Add `debugName` positional parameter to `ReceivePort` and `RawReceivePort` + constructors, a name which can be associated with the port and displayed in + tooling. #### `dart:html` -* `EventStreamSubscription.cancel` has been updated to retain its synchronous - timing when running in both sound and unsound null safety modes. See issue - [#44157][] for more details. +- `EventStreamSubscription.cancel` has been updated to retain its synchronous + timing when running in both sound and unsound null safety modes. See issue + [#44157][] for more details. [#44157]: https://github.com/dart-lang/sdk/issues/44157 ### Dart VM -* **Breaking Change** [#42312][]: `Dart_WeakPersistentHandle`s no longer - auto-delete themselves when the referenced object is garbage collected to - avoid race conditions, but they are still automatically deleted when the - isolate group shuts down. +- **Breaking Change** [#42312][]: `Dart_WeakPersistentHandle`s no longer + auto-delete themselves when the referenced object is garbage collected to + avoid race conditions, but they are still automatically deleted when the + isolate group shuts down. -* **Breaking Change** [#42312][]: `Dart_WeakPersistentHandleFinalizer` - is renamed to `Dart_HandleFinalizer` and had its `handle` argument removed. - All API functions using that type have been updated. +- **Breaking Change** [#42312][]: `Dart_WeakPersistentHandleFinalizer` is + renamed to `Dart_HandleFinalizer` and had its `handle` argument removed. All + API functions using that type have been updated. [#42312]: https://github.com/dart-lang/sdk/issues/42312 ### Foreign Function Interface (`dart:ffi`) -* **Breaking Change** [#44621][]: Invocations with a generic `T` of - `sizeOf`, `Pointer.elementAt()`, `Pointer.ref`, and - `Pointer[]` are being deprecated in the current stable - release (2.12), and are planned to be fully removed in the following stable - release (2.13). Consequently, `allocate` in `package:ffi` will no longer be - able to invoke `sizeOf` generically, and will be deprecated as well. - Instead, the `Allocator` it is introduced to `dart:ffi`, and also requires - a constant `T` on invocations. For migration notes see the breaking change - request. +- **Breaking Change** [#44621][]: Invocations with a generic `T` of `sizeOf`, + `Pointer.elementAt()`, `Pointer.ref`, and + `Pointer[]` are being deprecated in the current stable + release (2.12), and are planned to be fully removed in the following stable + release (2.13). Consequently, `allocate` in `package:ffi` will no longer be + able to invoke `sizeOf` generically, and will be deprecated as well. + Instead, the `Allocator` it is introduced to `dart:ffi`, and also requires a + constant `T` on invocations. For migration notes see the breaking change + request. -* **Breaking Change** [#44622][]: Subtypes of `Struct` without any native - member are being deprecated in the current stable release (2.12), and are - planned to be fully removed in the following stable release (2.13). - Migrate opaque types to extend `Opaque` rather than `Struct`. +- **Breaking Change** [#44622][]: Subtypes of `Struct` without any native member + are being deprecated in the current stable release (2.12), and are planned to + be fully removed in the following stable release (2.13). Migrate opaque types + to extend `Opaque` rather than `Struct`. [#44621]: https://github.com/dart-lang/sdk/issues/44621 [#44622]: https://github.com/dart-lang/sdk/issues/44622 ### Dart2JS -* Remove `--no-defer-class-types` and `--no-new-deferred-split`. +- Remove `--no-defer-class-types` and `--no-new-deferred-split`. ### Tools #### Analyzer -* Remove the `--use-fasta-parser`, `--preview-dart-2`, and - `--enable-assert-initializers` command line options. These options haven't - been supported in a while and were no-ops. +- Remove the `--use-fasta-parser`, `--preview-dart-2`, and + `--enable-assert-initializers` command line options. These options haven't + been supported in a while and were no-ops. -* Report diagnostics regarding the - [`@internal`](https://pub.dev/documentation/meta/latest/meta/internal-constant.html) - annotation. +- Report diagnostics regarding the + [`@internal`](https://pub.dev/documentation/meta/latest/meta/internal-constant.html) + annotation. -* Improve diagnostic-reporting regarding the - [`@doNotStore`](https://pub.dev/documentation/meta/latest/meta/doNotStore-constant.html) - annotation. +- Improve diagnostic-reporting regarding the + [`@doNotStore`](https://pub.dev/documentation/meta/latest/meta/doNotStore-constant.html) + annotation. -* Introduce a diagnostic which is reported when a library member named `main` - is not a function. +- Introduce a diagnostic which is reported when a library member named `main` is + not a function. -* Introduce a diagnostic which is reported when a `main` function's first - parameter is not a supertype of `List`. +- Introduce a diagnostic which is reported when a `main` function's first + parameter is not a supertype of `List`. -* Introduce diagnostics for when an `// ignore` comment contains an error code - which is not being reported, cannot be ignored, or is already being ignored. +- Introduce diagnostics for when an `// ignore` comment contains an error code + which is not being reported, cannot be ignored, or is already being ignored. -* Report diagnostics when using - [`@visibleForTesting`](https://pub.dev/documentation/meta/latest/meta/ - visibleForTesting-constant.html) on top-level variables. +- Report diagnostics when using + [`@visibleForTesting`](https://pub.dev/documentation/meta/latest/meta/ + visibleForTesting-constant.html) on top-level variables. -* Fix false positive reports of "unused element" for top-level setters and - getters. +- Fix false positive reports of "unused element" for top-level setters and + getters. -* Fix false positive reports regarding `@deprecated` field formal parameters - at their declaration. +- Fix false positive reports regarding `@deprecated` field formal parameters at + their declaration. -* For null safety, introduce a diagnostic which reports when a null-check will - always fail. +- For null safety, introduce a diagnostic which reports when a null-check will + always fail. -* Fix false positive reports regarding optional parameters on private - constructors being unused. +- Fix false positive reports regarding optional parameters on private + constructors being unused. -* Introduce a diagnostic which is reported when a constructor includes - duplicate field formal parameters. +- Introduce a diagnostic which is reported when a constructor includes duplicate + field formal parameters. -* Improve the "unused import" diagnostic when multiple import directives share - a common prefix. +- Improve the "unused import" diagnostic when multiple import directives share a + common prefix. -* Fix false positive "unused import" diagnostic regarding an import which - provides an extension method which is used. +- Fix false positive "unused import" diagnostic regarding an import which + provides an extension method which is used. -* For null safety, improve the messaging of "use of nullable value" - diagnostics for eight different contexts. +- For null safety, improve the messaging of "use of nullable value" diagnostics + for eight different contexts. -* Fix false positive reports regarding `@visibleForTesting` members in a - "hide" combinator of an import or export directive. +- Fix false positive reports regarding `@visibleForTesting` members in a "hide" + combinator of an import or export directive. -* Improve the messaging of "invalid override" diagnostics. +- Improve the messaging of "invalid override" diagnostics. -* Introduce a diagnostic which is reported when `Future.catchError` is - called with an `onError` callback which does not return `FutureOr`. +- Introduce a diagnostic which is reported when `Future.catchError` is called + with an `onError` callback which does not return `FutureOr`. #### dartfmt -* Don't duplicate comments on chained if elements. +- Don't duplicate comments on chained if elements. -* Preserve `?` in initializing formal function-typed parameters. +- Preserve `?` in initializing formal function-typed parameters. -* Fix performance issue with constructors that have no initializer list. +- Fix performance issue with constructors that have no initializer list. #### Linter Updated the Linter to `0.1.129`, which includes: -* New lints: `avoid_dynamic_calls`, `cast_nullable_to_non_nullable`, - `null_check_on_nullable_type_parameter`, - `tighten_type_of_initializing_formals`, `unnecessary_null_checks`, and - `avoid_type_to_string`. +- New lints: `avoid_dynamic_calls`, `cast_nullable_to_non_nullable`, + `null_check_on_nullable_type_parameter`, + `tighten_type_of_initializing_formals`, `unnecessary_null_checks`, and + `avoid_type_to_string`. -* Fix crash in `prefer_collection_literals` when there is no static parameter - element. +- Fix crash in `prefer_collection_literals` when there is no static parameter + element. -* Fix false negatives for `prefer_collection_literals` when a LinkedHashSet or - LinkedHashMap instantiation is passed as the argument to a function in any - position other than the first. +- Fix false negatives for `prefer_collection_literals` when a LinkedHashSet or + LinkedHashMap instantiation is passed as the argument to a function in any + position other than the first. -* Fix false negatives for `prefer_collection_literals` when a LinkedHashSet or - LinkedHashMap instantiation is used in a place with a static type other than - Set or Map. +- Fix false negatives for `prefer_collection_literals` when a LinkedHashSet or + LinkedHashMap instantiation is used in a place with a static type other than + Set or Map. -* Update to `package_names` to allow leading underscores. +- Update to `package_names` to allow leading underscores. -* Fix crashes in `unnecessary_null_checks` and - `missing_whitespace_between_adjacent_strings`. +- Fix crashes in `unnecessary_null_checks` and + `missing_whitespace_between_adjacent_strings`. -* Update to `void_checks` for null safety. +- Update to `void_checks` for null safety. -* Fix range error in `unnecessary_string_escapes`. +- Fix range error in `unnecessary_string_escapes`. -* Fix false positives in `unnecessary_null_types`. +- Fix false positives in `unnecessary_null_types`. -* Fix to `prefer_constructors_over_static_methods` to respect type - parameters. +- Fix to `prefer_constructors_over_static_methods` to respect type parameters. -* Update to `always_require_non_null_named_parameters` to be null safety-aware. +- Update to `always_require_non_null_named_parameters` to be null safety-aware. -* Update to `unnecessary_nullable_for_final_variable_declarations` to allow - dynamic. +- Update to `unnecessary_nullable_for_final_variable_declarations` to allow + dynamic. -* Update `overridden_fields` to not report on abstract parent fields. +- Update `overridden_fields` to not report on abstract parent fields. -* Fix to `unrelated_type_equality_checks` for null safety. +- Fix to `unrelated_type_equality_checks` for null safety. -* Improvements to `type_init_formals`to allow types not equal to the field - type. +- Improvements to `type_init_formals`to allow types not equal to the field type. -* Updates to `public_member_apis` to check generic type aliases. +- Updates to `public_member_apis` to check generic type aliases. -* Fix `close_sinks` to handle `this`-prefixed property accesses. +- Fix `close_sinks` to handle `this`-prefixed property accesses. -* Fix `unawaited_futures` to handle `Future` subtypes. +- Fix `unawaited_futures` to handle `Future` subtypes. -* Performance improvements to `always_use_package_imports`, - `avoid_renaming_method_parameters`, `prefer_relative_imports` and - `public_member_api_docs`. +- Performance improvements to `always_use_package_imports`, + `avoid_renaming_method_parameters`, `prefer_relative_imports` and + `public_member_api_docs`. #### Pub -* **Breaking**: The Dart SDK constraint is now **required** in `pubspec.yaml`. - You must include a section like: +- **Breaking**: The Dart SDK constraint is now **required** in `pubspec.yaml`. + You must include a section like: - ```yaml - environment: - sdk: '>=2.10.0 <3.0.0' - ``` + ```yaml + environment: + sdk: ">=2.10.0 <3.0.0" + ``` - See [#44072][]. + See [#44072][]. - For legacy dependencies without an SDK constraint, pub will now assume a - default language version of 2.7. + For legacy dependencies without an SDK constraint, pub will now assume a + default language version of 2.7. -* The top level `pub` executable has been deprecated. Use `dart pub` instead. - See [dart tool][]. +- The top level `pub` executable has been deprecated. Use `dart pub` instead. + See [dart tool][]. -* New command `dart pub add` that adds new dependencies to your - `pubspec.yaml`, and a corresponding `dart pub remove` that removes - dependencies. +- New command `dart pub add` that adds new dependencies to your `pubspec.yaml`, + and a corresponding `dart pub remove` that removes dependencies. -* New option `dart pub upgrade --major-versions` will update constraints in - your `pubspec.yaml` to match the the _resolvable_ column reported in `dart - pub outdated`. This allows users to easily upgrade to latest version for all - dependencies where this is possible, even if such upgrade requires an update - to the version constraint in `pubspec.yaml`. +- New option `dart pub upgrade --major-versions` will update constraints in your + `pubspec.yaml` to match the the _resolvable_ column reported in + `dart pub outdated`. This allows users to easily upgrade to latest version for + all dependencies where this is possible, even if such upgrade requires an + update to the version constraint in `pubspec.yaml`. - It is also possible to only upgrade the major version for a subset of your - dependencies using `dart pub upgrade --major-versions `. + It is also possible to only upgrade the major version for a subset of your + dependencies using `dart pub upgrade --major-versions `. -* New option `dart pub upgrade --null-safety` will attempt to update constraints - in your `pubspec.yaml`, such that only null-safety migrated versions of - dependencies are allowed. +- New option `dart pub upgrade --null-safety` will attempt to update constraints + in your `pubspec.yaml`, such that only null-safety migrated versions of + dependencies are allowed. -* New option `dart pub outdated --mode=null-safety` that will analyze your - dependencies for null-safety. +- New option `dart pub outdated --mode=null-safety` that will analyze your + dependencies for null-safety. -* `dart pub get` and `dart pub upgrade` will highlight dependencies that have - been [discontinued](https://dart.dev/tools/pub/publishing#discontinue) on - pub.dev. +- `dart pub get` and `dart pub upgrade` will highlight dependencies that have + been [discontinued](https://dart.dev/tools/pub/publishing#discontinue) on + pub.dev. -* `dart pub publish` will now check your pubspec keys for likely typos. +- `dart pub publish` will now check your pubspec keys for likely typos. -* `dart pub upgrade package_foo` fetchs dependencies but ignores the - `pubspec.lock` for `package_foo`, allowing users to only upgrade a subset of - dependencies. +- `dart pub upgrade package_foo` fetchs dependencies but ignores the + `pubspec.lock` for `package_foo`, allowing users to only upgrade a subset of + dependencies. -* New command `dart pub login` that logs in to pub.dev. +- New command `dart pub login` that logs in to pub.dev. -* The `--server` option to `dart pub publish` and `dart pub uploader` are - deprecated. Use `publish_to` in your `pubspec.yaml` or set the - `$PUB_HOSTED_URL` environment variable. +- The `--server` option to `dart pub publish` and `dart pub uploader` are + deprecated. Use `publish_to` in your `pubspec.yaml` or set the + `$PUB_HOSTED_URL` environment variable. -* `pub global activate` no longer re-precompiles if the current global - installation was same version. +- `pub global activate` no longer re-precompiles if the current global + installation was same version. -* The Flutter SDK constraint upper bound is now ignored in pubspecs and - deprecated when publishing. See: [flutter-upper-bound-deprecation][]. +- The Flutter SDK constraint upper bound is now ignored in pubspecs and + deprecated when publishing. See: [flutter-upper-bound-deprecation][]. -[flutter-upper-bound-deprecation]: https://dart.dev/go/flutter-upper-bound-deprecation +[flutter-upper-bound-deprecation]: + https://dart.dev/go/flutter-upper-bound-deprecation [#44072]: https://github.com/dart-lang/sdk/issues/44072 [dart tool]: https://dart.dev/tools/dart-tool @@ -733,20 +728,21 @@ This is a patch release that fixes a crash in the Dart VM (issues [#43941][], [#43941]: https://github.com/dart-lang/sdk/issues/43941 [flutter/flutter#43620]: https://github.com/flutter/flutter/issues/43620 -[Dart-Code/Dart-Code#2814]: https://github.com/Dart-Code/Dart-Code/issues/2814 +[dart-code/dart-code#2814]: https://github.com/Dart-Code/Dart-Code/issues/2814 ## 2.10.3 - 2020-10-29 This is a patch release that fixes the following issues: -* breaking changes in Chrome 86 that affect DDC (issues [#43750][] and + +- breaking changes in Chrome 86 that affect DDC (issues [#43750][] and [#43193][]). -* compiler error causing incorrect use of positional parameters when named +- compiler error causing incorrect use of positional parameters when named parameters should be used instead (issues [flutter/flutter#65324][] and [flutter/flutter#68092][]). -* crashes and/or undefined behavor in AOT compiled code (issues [#43770][] and +- crashes and/or undefined behavor in AOT compiled code (issues [#43770][] and [#43786][]). -* AOT compilation of classes with more than 64 unboxed fields - (issue [flutter/flutter#67803][]). +- AOT compilation of classes with more than 64 unboxed fields (issue + [flutter/flutter#67803][]). [#43750]: https://github.com/dart-lang/sdk/issues/43750 [#43193]: https://github.com/dart-lang/sdk/issues/43193 @@ -765,10 +761,11 @@ This is a patch release that fixes a DDC compiler crash (issue [#43589]). ## 2.10.1 - 2020-10-06 This is a patch release that fixes the following issues: -* crashes when developing Flutter applications (issue [#43464][]). -* non-deterministic incorrect program behaviour and/or crashes (issue + +- crashes when developing Flutter applications (issue [#43464][]). +- non-deterministic incorrect program behaviour and/or crashes (issue [flutter/flutter#66672][]). -* uncaught TypeErrors in DDC (issue [#43661][]). +- uncaught TypeErrors in DDC (issue [#43661][]). [#43464]: https://github.com/dart-lang/sdk/issues/43464 [flutter/flutter#66672]: https://github.com/flutter/flutter/issues/66672 @@ -780,81 +777,81 @@ This is a patch release that fixes the following issues: #### `dart:io` -* Adds `Abort` method to class `HttpClientRequest`, which allows users - to cancel outgoing HTTP requests and stop following IO operations. -* A validation check is added to `path` of class `Cookie`. Having characters - ranging from 0x00 to 0x1f and 0x3b (";") will lead to a `FormatException`. -* The `HttpClient` and `HttpServer` classes now have a 1 MiB limit for the - total size of the HTTP headers when parsing a request or response, instead - of the former 8 KiB limit for each header name and value. This limit cannot - be configured at this time. +- Adds `Abort` method to class `HttpClientRequest`, which allows users to cancel + outgoing HTTP requests and stop following IO operations. +- A validation check is added to `path` of class `Cookie`. Having characters + ranging from 0x00 to 0x1f and 0x3b (";") will lead to a `FormatException`. +- The `HttpClient` and `HttpServer` classes now have a 1 MiB limit for the total + size of the HTTP headers when parsing a request or response, instead of the + former 8 KiB limit for each header name and value. This limit cannot be + configured at this time. #### `dart:typed_data` -* Class `BytesBuilder` is moved from `dart:io` to `dart:typed_data`. - It's temporarily being exported from `dart:io` as well. +- Class `BytesBuilder` is moved from `dart:io` to `dart:typed_data`. It's + temporarily being exported from `dart:io` as well. ### `dart:uri` -* [#42564]: Solved inconsistency in `Uri.https` and `Uri.http` constructors' - `queryParams` type. +- [#42564]: Solved inconsistency in `Uri.https` and `Uri.http` constructors' + `queryParams` type. ### Dart VM -* **Breaking Change** [#42982][]: `dart_api_dl.cc` is renamed to - `dart_api_dl.c` and changed to a pure C file. -* Introduces `Dart_FinalizableHandle`s. They do auto-delete, and the weakly - referred object cannot be accessed through them. +- **Breaking Change** [#42982][]: `dart_api_dl.cc` is renamed to `dart_api_dl.c` + and changed to a pure C file. +- Introduces `Dart_FinalizableHandle`s. They do auto-delete, and the weakly + referred object cannot be accessed through them. ### Dart2JS -* Adds support for deferred loading of types seperately from classes. This - enables dart2js to make better optimization choices when deferred loading. - This work is necessary to address unsoundness in the deferred loading - algorithm. Currently, fixing this unsoundness would result in code bloat, - but loading types seperately from classes will allow us to fix the - unsoundness with only a minimal regression. To explicitly disable - deferred loading of types, pass `--no-defer-class-types`. See the original - post on the [unsoundness in the deferred loading algorithm][]. -* Enables a new sound deferred splitting algorithm. To explicitly disable - the new deferred splitting algorithm, pass `--no-new-deferred-split`. - See the original post on the - [unsoundness in the deferred loading algorithm][]. - +- Adds support for deferred loading of types seperately from classes. This + enables dart2js to make better optimization choices when deferred loading. + This work is necessary to address unsoundness in the deferred loading + algorithm. Currently, fixing this unsoundness would result in code bloat, but + loading types seperately from classes will allow us to fix the unsoundness + with only a minimal regression. To explicitly disable deferred loading of + types, pass `--no-defer-class-types`. See the original post on the + [unsoundness in the deferred loading algorithm][]. +- Enables a new sound deferred splitting algorithm. To explicitly disable the + new deferred splitting algorithm, pass `--no-new-deferred-split`. See the + original post on the [unsoundness in the deferred loading algorithm][]. [#42982]: https://github.com/dart-lang/sdk/issues/42982 -[unsoundness in the deferred loading algorithm]: https://github.com/dart-lang/sdk/blob/302ad7ab2cd2de936254850550aad128ae76bbb7/CHANGELOG.md#dart2js-3 +[unsoundness in the deferred loading algorithm]: + https://github.com/dart-lang/sdk/blob/302ad7ab2cd2de936254850550aad128ae76bbb7/CHANGELOG.md#dart2js-3 ### Tools #### dartfmt -* Don't crash when non-ASCII whitespace is trimmed. -* Split all conditional expressions (`?:`) when they are nested. -* Handle `external` and `abstract` fields and variables. +- Don't crash when non-ASCII whitespace is trimmed. +- Split all conditional expressions (`?:`) when they are nested. +- Handle `external` and `abstract` fields and variables. #### Linter Updated the Linter to `0.1.118`, which includes: -* New lint: `unnecessary_nullable_for_final_variable_declarations`. -* Fixed NPE in `prefer_asserts_in_initializer_lists`. -* Fixed range error in `unnecessary_string_escapes`. -* `unsafe_html` updated to support unique error codes. -* Updates to `diagnostic_describe_all_properties` to check for `Diagnosticable`s (not `DiagnosticableMixin`s). -* New lint: `use_late`. -* Fixed `unnecessary_lambdas` to respect deferred imports. -* Updated `public_member_api_docs` to check mixins. -* Updated `unnecessary_statements` to skip `as` expressions. -* Fixed `prefer_relative_imports` to work with path dependencies. +- New lint: `unnecessary_nullable_for_final_variable_declarations`. +- Fixed NPE in `prefer_asserts_in_initializer_lists`. +- Fixed range error in `unnecessary_string_escapes`. +- `unsafe_html` updated to support unique error codes. +- Updates to `diagnostic_describe_all_properties` to check for `Diagnosticable`s + (not `DiagnosticableMixin`s). +- New lint: `use_late`. +- Fixed `unnecessary_lambdas` to respect deferred imports. +- Updated `public_member_api_docs` to check mixins. +- Updated `unnecessary_statements` to skip `as` expressions. +- Fixed `prefer_relative_imports` to work with path dependencies. #### Pub -* `pub run` and `pub global run` accepts a `--(no-)-sound-null-safety` flag, +- `pub run` and `pub global run` accepts a `--(no-)-sound-null-safety` flag, that is passed to the VM. -* Fix: Avoid multiple recompilation of binaries in global packages. -* Fix: Avoid exponential behaviour of error reporting from the solver. -* Fix: Refresh binstubs after recompile in global run. +- Fix: Avoid multiple recompilation of binaries in global packages. +- Fix: Avoid exponential behaviour of error reporting from the solver. +- Fix: Refresh binstubs after recompile in global run. ## 2.9.3 - 2020-09-08 @@ -885,72 +882,71 @@ applications (issue [flutter/flutter#63038][]). #### `dart:async` -* Adds `Stream.multi` constructor creating streams which can be - listened to more than once, and where each individual listener - can be controlled independently. +- Adds `Stream.multi` constructor creating streams which can be listened to more + than once, and where each individual listener can be controlled independently. #### `dart:convert` -* **Breaking Change** [#41100][]: When encoding a string containing unpaired - surrogates as UTF-8, the unpaired surrogates will be encoded as replacement - characters (`U+FFFD`). When decoding UTF-8, encoded surrogates will be - treated as malformed input. When decoding UTF-8 with `allowMalformed: true`, - the number of replacement characters emitted for malformed input sequences - has been changed to match the [WHATWG encoding standard][]. +- **Breaking Change** [#41100][]: When encoding a string containing unpaired + surrogates as UTF-8, the unpaired surrogates will be encoded as replacement + characters (`U+FFFD`). When decoding UTF-8, encoded surrogates will be treated + as malformed input. When decoding UTF-8 with `allowMalformed: true`, the + number of replacement characters emitted for malformed input sequences has + been changed to match the [WHATWG encoding standard][]. [#41100]: https://github.com/dart-lang/sdk/issues/41100 -[WHATWG encoding standard]: https://encoding.spec.whatwg.org/#utf-8-decoder +[whatwg encoding standard]: https://encoding.spec.whatwg.org/#utf-8-decoder #### `dart:io` -* [#42006][]: The signature of `exit` has been changed to return the - `Never`type instead of `void`. since no code will run after it, -* Class `OSError` now implements `Exception`. This change means `OSError` will - now be caught in catch clauses catching `Exception`s. -* Added `InternetAddress.tryParse`. -* [Abstract Unix Domain Socket][] is supported on Linux/Android now. Using an - `InternetAddress` with `address` starting with '@' and type being - `InternetAddressType.Unix` will create an abstract Unix Domain Socket. -* On Windows, file APIs can now handle files and directories identified by - long paths (greater than 260 characters). It complies with all restrictions - from [Long Path on Windows][]. Note that `Directory.current` does not work - with long path. +- [#42006][]: The signature of `exit` has been changed to return the `Never`type + instead of `void`. since no code will run after it, +- Class `OSError` now implements `Exception`. This change means `OSError` will + now be caught in catch clauses catching `Exception`s. +- Added `InternetAddress.tryParse`. +- [Abstract Unix Domain Socket][] is supported on Linux/Android now. Using an + `InternetAddress` with `address` starting with '@' and type being + `InternetAddressType.Unix` will create an abstract Unix Domain Socket. +- On Windows, file APIs can now handle files and directories identified by long + paths (greater than 260 characters). It complies with all restrictions from + [Long Path on Windows][]. Note that `Directory.current` does not work with + long path. [#42006]: https://github.com/dart-lang/sdk/issues/42006 -[Abstract Unix Domain Socket]: http://man7.org/linux/man-pages/man7/unix.7.html -[Long Path on Windows]: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation +[abstract unix domain socket]: http://man7.org/linux/man-pages/man7/unix.7.html +[long path on windows]: + https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation #### `dart:html` -* **Breaking Change**: `CssClassSet.add()` previously returned `null` if the - `CssClassSet` corresponded to multiple elements. In order to align with the - null-safe changes in the `Set` interface, it will now return `false` - instead. The same applies for `CssClassSet.toggle`. +- **Breaking Change**: `CssClassSet.add()` previously returned `null` if the + `CssClassSet` corresponded to multiple elements. In order to align with the + null-safe changes in the `Set` interface, it will now return `false` instead. + The same applies for `CssClassSet.toggle`. -* `EventStreamSubscription.cancel` method used to return `null`, but since - `StreamSubscription.cancel` has changed to be non-nullable, this method - returns an empty `Future` instead. Due to an optimization on `null` - `Future`s, this method used to complete synchronously, but now that the - `Future` is empty instead, it completes asynchronously, therefore - potentially invalidating code that relied on the synchronous side-effect. - This change will only affect code using sound null-safety. See issue - [#41653][] for more details. +- `EventStreamSubscription.cancel` method used to return `null`, but since + `StreamSubscription.cancel` has changed to be non-nullable, this method + returns an empty `Future` instead. Due to an optimization on `null` `Future`s, + this method used to complete synchronously, but now that the `Future` is empty + instead, it completes asynchronously, therefore potentially invalidating code + that relied on the synchronous side-effect. This change will only affect code + using sound null-safety. See issue [#41653][] for more details. -* Methods in `Console` have been updated to better reflect the modern Console - specification. Particularly of interest are `dir` and `table` which take in - extra optional arguments. +- Methods in `Console` have been updated to better reflect the modern Console + specification. Particularly of interest are `dir` and `table` which take in + extra optional arguments. [#41653]: https://github.com/dart-lang/sdk/issues/41653 #### `dart:mirrors` -* **Breaking Change** [#42714][]: web compilers (dart2js and DDC) now produce - a compile-time error if `dart:mirrors` is imported. +- **Breaking Change** [#42714][]: web compilers (dart2js and DDC) now produce a + compile-time error if `dart:mirrors` is imported. - Most projects should not be affected. Since 2.0.0 this library was - unsupported and produced runtime errors on all its APIs. Since then several - tools already reject code that use `dart:mirrors` including webdev and - flutter tools, we expect few projects to run into this problem. + Most projects should not be affected. Since 2.0.0 this library was unsupported + and produced runtime errors on all its APIs. Since then several tools already + reject code that use `dart:mirrors` including webdev and flutter tools, we + expect few projects to run into this problem. [#42714]: https://github.com/dart-lang/sdk/issues/42714 @@ -958,72 +954,71 @@ applications (issue [flutter/flutter#63038][]). #### dartfmt -* Add `--fix-single-cascade-statements`. -* Correctly handle `var` in `--fix-function-typedefs`. -* Preserve leading indentation in fixed doc comments. -* Split outer nested control flow elements. -* Always place a blank line after script tags. -* Don't add unneeded splits on if elements near comments. -* Indent blocks in initializers of multiple-variable declarations. -* Update the null-aware subscript syntax from `?.[]` to `?[]`. +- Add `--fix-single-cascade-statements`. +- Correctly handle `var` in `--fix-function-typedefs`. +- Preserve leading indentation in fixed doc comments. +- Split outer nested control flow elements. +- Always place a blank line after script tags. +- Don't add unneeded splits on if elements near comments. +- Indent blocks in initializers of multiple-variable declarations. +- Update the null-aware subscript syntax from `?.[]` to `?[]`. #### Analyzer -* Static analyses with a severity of "error" can no longer be ignored with +- Static analyses with a severity of "error" can no longer be ignored with comments (`// ignore: code` and `// ignore_for_file: code`). #### Linter Updated the Linter to `0.1.117`, which includes: -* New lint: `do_not_use_environment`. -* New lint: `exhaustive_cases`. -* New lint: `no_default_cases` (experimental). -* New lint: `sized_box_for_whitespace`. -* New lint: `use_is_even_rather_than_modulo`. -* Updated `directives_ordering` to remove third party package special-casing. -* Updated `prefer_is_empty` to special-case assert initializers and const +- New lint: `do_not_use_environment`. +- New lint: `exhaustive_cases`. +- New lint: `no_default_cases` (experimental). +- New lint: `sized_box_for_whitespace`. +- New lint: `use_is_even_rather_than_modulo`. +- Updated `directives_ordering` to remove third party package special-casing. +- Updated `prefer_is_empty` to special-case assert initializers and const contexts. -* Updated `prefer_mixin` to allow "legacy" SDK abstract class mixins. -* Updated `sized_box_for_whitespace` to address false-positives. -* Updated `type_annotate_public_apis` to allow inferred types in final field +- Updated `prefer_mixin` to allow "legacy" SDK abstract class mixins. +- Updated `sized_box_for_whitespace` to address false-positives. +- Updated `type_annotate_public_apis` to allow inferred types in final field assignments. -* Updated `unnecessary_lambdas` to check for tear-off assignability. -* Updated `unsafe_html` to use a `SecurityLintCode` (making it un-ignorable) and +- Updated `unnecessary_lambdas` to check for tear-off assignability. +- Updated `unsafe_html` to use a `SecurityLintCode` (making it un-ignorable) and to include `Window.open`, `Element.html` and `DocumentFragment.html` in unsafe API checks. Also added checks for attributes and methods on extensions. ### Dart VM -* **Breaking Change** [#41100][]: When printing a string using the `print` - function, the default implementation (used when not overridden by the - embedder or the current zone) will print any unpaired surrogates in the - string as replacement characters (`U+FFFD`). Similarly, the - `Dart_StringToUTF8` function in the Dart API will convert unpaired - surrogates into replacement characters. +- **Breaking Change** [#41100][]: When printing a string using the `print` + function, the default implementation (used when not overridden by the embedder + or the current zone) will print any unpaired surrogates in the string as + replacement characters (`U+FFFD`). Similarly, the `Dart_StringToUTF8` function + in the Dart API will convert unpaired surrogates into replacement characters. ### Pub -* `pub run` and `pub global run` accepts a `--enable-experiment` flag enabling + +- `pub run` and `pub global run` accepts a `--enable-experiment` flag enabling experiments in the Dart VM (and language). -* Warn when publishing the first null-safe version of a package. -* `pub outdated`: - * If the current version of a dependency is a prerelease - version, use prereleases for latest if there is no newer stable. - * Don't require a `pubspec.lock` file. When the lockfile is missing, the +- Warn when publishing the first null-safe version of a package. +- `pub outdated`: + - If the current version of a dependency is a prerelease version, use + prereleases for latest if there is no newer stable. + - Don't require a `pubspec.lock` file. When the lockfile is missing, the **Current** column is empty. -* `pub upgrade`: Show summary count of outdated packages after running. - It will also only show newer packages if they are not prereleases or - the package is already a prerelease. -* Publishing Flutter plugins using the old plugin format is no longer allowed. +- `pub upgrade`: Show summary count of outdated packages after running. It will + also only show newer packages if they are not prereleases or the package is + already a prerelease. +- Publishing Flutter plugins using the old plugin format is no longer allowed. Plugins using the old plugin format can still be consumed. -* `pub run`: Fix precompilation with relative `PUB_CACHE` paths +- `pub run`: Fix precompilation with relative `PUB_CACHE` paths ([#2486](https://github.com/dart-lang/pub/pull/2486)). -* Preserve Windows line endings in `pubspec.lock` if they are already there +- Preserve Windows line endings in `pubspec.lock` if they are already there ([#2489](https://github.com/dart-lang/pub/pull/2489)). -* Better terminal color-detection. Use colors in terminals on Windows. -* Fix git folder names in cache, allowing for ssh-style git - dependencies. -* Fix: Avoid precompilation of dependencies of global packages. +- Better terminal color-detection. Use colors in terminals on Windows. +- Fix git folder names in cache, allowing for ssh-style git dependencies. +- Fix: Avoid precompilation of dependencies of global packages. ## 2.8.4 - 2020-06-04 @@ -1036,10 +1031,11 @@ This is a patch release that fixes potential memory leaks in the Dart front-end ## 2.8.3 - 2020-05-28 This is a patch release that fixes the following issues: -* crashes in Flutter apps (issue [flutter/flutter#57318][]). -* a regression in stack traces (issue [#41907][]). -* re-canonicalization of constants with unboxed fields (issue -[flutter/flutter#57190][]). + +- crashes in Flutter apps (issue [flutter/flutter#57318][]). +- a regression in stack traces (issue [#41907][]). +- re-canonicalization of constants with unboxed fields (issue + [flutter/flutter#57190][]). [flutter/flutter#57318]: https://github.com/flutter/flutter/issues/57318 [#41907]: https://github.com/dart-lang/sdk/issues/41907 @@ -1048,8 +1044,8 @@ This is a patch release that fixes the following issues: ## 2.8.2 - 2020-05-13 This is a patch release that fixes an AOT compilation bug in global -transformations which manifests as a NoSuchMethod exception -(issue [flutter/flutter#56479][]). +transformations which manifests as a NoSuchMethod exception (issue +[flutter/flutter#56479][]). [flutter/flutter#56479]: https://github.com/flutter/flutter/issues/56479 @@ -1064,17 +1060,16 @@ unexpected failures, note the breaking changes listed below. ### Language -There are no new language features in this release. There are only two -minor breaking changes: +There are no new language features in this release. There are only two minor +breaking changes: -* **Breaking change** [#40675][]: Fixed an implementation bug where local - variable inference would incorrectly use the promoted type of a type - variable. +- **Breaking change** [#40675][]: Fixed an implementation bug where local + variable inference would incorrectly use the promoted type of a type variable. -* **Breaking change** [#41362][]: Dart 2.0.0 made the clauses `implements - Function`, `extends Function`, or `with Function` have no effect (spec - section 19.6). We fixed an implementation bug that may be visible on some - rare scenarios. +- **Breaking change** [#41362][]: Dart 2.0.0 made the clauses + `implements Function`, `extends Function`, or `with Function` have no effect + (spec section 19.6). We fixed an implementation bug that may be visible on + some rare scenarios. [#40675]: https://github.com/dart-lang/sdk/issues/40675 [#41362]: https://github.com/dart-lang/sdk/issues/41362 @@ -1083,26 +1078,25 @@ minor breaking changes: #### `dart:async` -* **Breaking change** [#40676][]: Changed the return type of - `StreamSubscription.cancel()` to `Future`. Previously, it was - declared to return `Future` and was allowed to return `null` at runtime. +- **Breaking change** [#40676][]: Changed the return type of + `StreamSubscription.cancel()` to `Future`. Previously, it was declared + to return `Future` and was allowed to return `null` at runtime. -* **Breaking change** [#40681][]: The `runZoned()` function is split into two - functions: `runZoned()` and `runZonedGuarded()`, where the latter has a - required `onError` parameter, and the former has none. This prepares the - functions for null safety where the two functions will differ in the - nullability of their return types. +- **Breaking change** [#40681][]: The `runZoned()` function is split into two + functions: `runZoned()` and `runZonedGuarded()`, where the latter has a + required `onError` parameter, and the former has none. This prepares the + functions for null safety where the two functions will differ in the + nullability of their return types. -* **Breaking change** [#40683][]: Errors passed to - `Completer.completeError()`, `Stream.addError()`, `Future.error()`, etc. can - no longer be `null`. These operations now *synchronously* throw an exception - if passed a `null` error. +- **Breaking change** [#40683][]: Errors passed to `Completer.completeError()`, + `Stream.addError()`, `Future.error()`, etc. can no longer be `null`. These + operations now _synchronously_ throw an exception if passed a `null` error. -* Make stack traces non-null [#40130][]. Where methods like - `completer.completeError()` allow omitting a stack trace, the platform will - now insert a default stack trace rather than propagate a `null` value. +- Make stack traces non-null [#40130][]. Where methods like + `completer.completeError()` allow omitting a stack trace, the platform will + now insert a default stack trace rather than propagate a `null` value. - Error handling functions need no longer be prepared for `null` stack traces. + Error handling functions need no longer be prepared for `null` stack traces. [#40676]: https://github.com/dart-lang/sdk/issues/40676 [#40681]: https://github.com/dart-lang/sdk/issues/40681 @@ -1111,35 +1105,35 @@ minor breaking changes: #### `dart:core` -* **Breaking change** [#40674][]: Three members on `RuneIterator` no longer - return `null` when accessed before the first call to `moveNext()`. Instead, - `current` and `rawIndex` return `-1` and `currentAsString` returns an empty - string. +- **Breaking change** [#40674][]: Three members on `RuneIterator` no longer + return `null` when accessed before the first call to `moveNext()`. Instead, + `current` and `rawIndex` return `-1` and `currentAsString` returns an empty + string. -* **Breaking change** [#40678][]: The `String.fromEnvironment()` default value - for `defaultValue` is now an empty string instead of `null`. Likewise, the - default value for `int.fromEnvironment()`'s `defaultValue` parameter is - zero. Under null safety, a constructor cannot return `null`, so this - prepares these APIs for that. +- **Breaking change** [#40678][]: The `String.fromEnvironment()` default value + for `defaultValue` is now an empty string instead of `null`. Likewise, the + default value for `int.fromEnvironment()`'s `defaultValue` parameter is zero. + Under null safety, a constructor cannot return `null`, so this prepares these + APIs for that. -* The class `CastError` is deprecated, and all implementation specific classes - implementing `TypeError` or `CastError` now implement both. In a future - release, `CastError` will be removed. See issue [40763][] for details. +- The class `CastError` is deprecated, and all implementation specific classes + implementing `TypeError` or `CastError` now implement both. In a future + release, `CastError` will be removed. See issue [40763][] for details. -* Adds `StackTrace.empty` constant which is the stack trace used as default - stack trace when no better alternative is available. +- Adds `StackTrace.empty` constant which is the stack trace used as default + stack trace when no better alternative is available. -* The class `TypeError` no longer extends `AssertionError`. This also means - that it no longer inherits the spurious `message` getter which was added to - `AssertionError` when the second operand to `assert` was allowed. The value - of that getter on a `TypeError` was the same string as returned by - `toString()`, so it is still available. +- The class `TypeError` no longer extends `AssertionError`. This also means that + it no longer inherits the spurious `message` getter which was added to + `AssertionError` when the second operand to `assert` was allowed. The value of + that getter on a `TypeError` was the same string as returned by `toString()`, + so it is still available. -* `ArgumentError.checkNotNull()` and the `RangeError` static methods - `checkValueInInterval()`, `checkValidIndex()` and `checkNotNegative()` all - return their first argument on success. This makes these functions more - convenient to use in-line in, for example, `=>` function bodies or - constructor initialization lists. +- `ArgumentError.checkNotNull()` and the `RangeError` static methods + `checkValueInInterval()`, `checkValidIndex()` and `checkNotNegative()` all + return their first argument on success. This makes these functions more + convenient to use in-line in, for example, `=>` function bodies or constructor + initialization lists. [#40674]: https://github.com/dart-lang/sdk/issues/40674 [#40678]: https://github.com/dart-lang/sdk/issues/40678 @@ -1147,165 +1141,163 @@ minor breaking changes: #### `dart:developer` -* The constructors for `TimelineTask` now accept an optional `filterKey` - parameter. If provided, the arguments for all events associated with the - task will contain an entry named `filterKey`, set to the value of the - `filterKey` parameter provided in the constructor. This will be used by - tooling to allow for better filtering of timeline events. +- The constructors for `TimelineTask` now accept an optional `filterKey` + parameter. If provided, the arguments for all events associated with the task + will contain an entry named `filterKey`, set to the value of the `filterKey` + parameter provided in the constructor. This will be used by tooling to allow + for better filtering of timeline events. #### `dart:html` -* **Breaking Change** [#39627][]: Changed the return type of several HTML - native methods involving futures. In return types that matched - `Future>`, `T was` changed to `dynamic`. These methods would have - resulted in a runtime error if they were used. +- **Breaking Change** [#39627][]: Changed the return type of several HTML native + methods involving futures. In return types that matched `Future>`, + `T was` changed to `dynamic`. These methods would have resulted in a runtime + error if they were used. -* **Breaking Change**: `Node.insertAllBefore()` erroneously had a return type - of `Node`, even though it was not returning anything. This has been - corrected to `void`. +- **Breaking Change**: `Node.insertAllBefore()` erroneously had a return type of + `Node`, even though it was not returning anything. This has been corrected to + `void`. [#39627]: https://github.com/dart-lang/sdk/issues/39627 #### `dart:io` -* Class `HttpParser` will no longer throw an exception when a HTTP response - status code is within [0, 999]. Customized status codes in this range are - now valid. +- Class `HttpParser` will no longer throw an exception when a HTTP response + status code is within [0, 999]. Customized status codes in this range are now + valid. -* **Breaking change** [#33501][]: The signature of `HttpHeaders` methods - `add()` and `set` have been changed to: +- **Breaking change** [#33501][]: The signature of `HttpHeaders` methods `add()` + and `set` have been changed to: - ```dart - void add(String name, Object value, {bool preserveHeaderCase: false}) - void set(String name, Object value, {bool preserveHeaderCase: false}) - ``` + ```dart + void add(String name, Object value, {bool preserveHeaderCase: false}) + void set(String name, Object value, {bool preserveHeaderCase: false}) + ``` - Setting `preserveHeaderCase` to `true` preserves the case of the `name` - parameter instead of converting it to lowercase. The `HttpHeader.forEach()` - method provides the current case of each header. + Setting `preserveHeaderCase` to `true` preserves the case of the `name` + parameter instead of converting it to lowercase. The `HttpHeader.forEach()` + method provides the current case of each header. - This is breaking only for classes extending or implementing `HttpHeaders` - and having their own `add` or `set` methods without the `bool - preserveHeaderCase` named parameter. + This is breaking only for classes extending or implementing `HttpHeaders` and + having their own `add` or `set` methods without the `bool preserveHeaderCase` + named parameter. -* **Breaking change** [#40702][]: The `Socket` class now throws a - `SocketException` if the socket has been explicitly destroyed or upgraded to - a secure socket upon setting or getting socket options. Previously, setting - a socket option would be ignored and getting a socket option would return - `null`. +- **Breaking change** [#40702][]: The `Socket` class now throws a + `SocketException` if the socket has been explicitly destroyed or upgraded to a + secure socket upon setting or getting socket options. Previously, setting a + socket option would be ignored and getting a socket option would return + `null`. -* **Breaking change** [#40483][]: The `Process` class now throws a - `StateError` if the process is detached (`ProcessStartMode.detached` and - `ProcessStartMode.detachedWithStdio`) upon accessing the `exitCode` getter. - It now also throws when not connected to the child process's stdio - (`ProcessStartMode.detached` and `ProcessStartMode.inheritStdio`) upon - accessing the `stdin`, `stdout`, and `stderr` getters. Previously, these - getters would all return `null`. +- **Breaking change** [#40483][]: The `Process` class now throws a `StateError` + if the process is detached (`ProcessStartMode.detached` and + `ProcessStartMode.detachedWithStdio`) upon accessing the `exitCode` getter. It + now also throws when not connected to the child process's stdio + (`ProcessStartMode.detached` and `ProcessStartMode.inheritStdio`) upon + accessing the `stdin`, `stdout`, and `stderr` getters. Previously, these + getters would all return `null`. -* **Breaking change** [#40706][]: The dummy object returned if - `FileStat.stat()` or `FileStat.statSync()` fail now contains Unix epoch - timestamps instead of `null` for the `accessed`, `changed`, and `modified` - getters. +- **Breaking change** [#40706][]: The dummy object returned if `FileStat.stat()` + or `FileStat.statSync()` fail now contains Unix epoch timestamps instead of + `null` for the `accessed`, `changed`, and `modified` getters. -* **Breaking change** [#40709][]: The `HeaderValue` class now parses more - strictly in two invalid edge cases. This is the class used to parse the - semicolon delimited parameters used in the `Accept`, `Authorization`, - `Content-Type`, and other such HTTP headers. +- **Breaking change** [#40709][]: The `HeaderValue` class now parses more + strictly in two invalid edge cases. This is the class used to parse the + semicolon delimited parameters used in the `Accept`, `Authorization`, + `Content-Type`, and other such HTTP headers. - The empty parameter value without double quotes (which is not allowed by the - standards) is now parsed as the empty string rather than `null`. E.g. - `HeaderValue.parse("v;a=").parameters` now gives `{"a": ""}` rather than - `{"a": null}`. + The empty parameter value without double quotes (which is not allowed by the + standards) is now parsed as the empty string rather than `null`. E.g. + `HeaderValue.parse("v;a=").parameters` now gives `{"a": ""}` rather than + `{"a": null}`. - Invalid inputs with unbalanced double quotes are now rejected. E.g. - `HeaderValue.parse('v;a="b').parameters` will now throw a `HttpException` - instead of giving `{"a": "b"}`. + Invalid inputs with unbalanced double quotes are now rejected. E.g. + `HeaderValue.parse('v;a="b').parameters` will now throw a `HttpException` + instead of giving `{"a": "b"}`. -* The `HeaderValue.toString()` method now supports parameters with `null` - values by omitting the value. `HeaderValue("v", {"a": null, "b": - "c"}).toString()` now gives `v; a; b=c`. This behavior can be used to - implement some features in the `Accept` and `Sec-WebSocket-Extensions` - headers. +- The `HeaderValue.toString()` method now supports parameters with `null` values + by omitting the value. `HeaderValue("v", {"a": null, "b": "c"}).toString()` + now gives `v; a; b=c`. This behavior can be used to implement some features in + the `Accept` and `Sec-WebSocket-Extensions` headers. - Likewise the empty value and values using characters outside of [RFC 7230 - tokens][] are now correctly implemented by double quoting such values with - escape sequences. For example: + Likewise the empty value and values using characters outside of [RFC 7230 + tokens][] are now correctly implemented by double quoting such values with + escape sequences. For example: - ```dart - HeaderValue("v", - {"a": "A", "b": "(B)", "c": "", "d": "ø", "e": "\\\""}).toString() - ``` + ```dart + HeaderValue("v", + {"a": "A", "b": "(B)", "c": "", "d": "ø", "e": "\\\""}).toString() + ``` - Gives: `v;a=A;b="(B)";c="";d="ø";e="\\\""`. + Gives: `v;a=A;b="(B)";c="";d="ø";e="\\\""`. -* [Unix domain sockets][] are now supported on Linux, Android and MacOS, which - can be used by passing a `InternetAddress` of `InternetAddressType.Unix` - into the `connect()`, `startConnect()` and `bind()` methods. The `port` - argument in those methods will be ignored. The `port` getter always returns - 0 for Unix domain sockets. +- [Unix domain sockets][] are now supported on Linux, Android and MacOS, which + can be used by passing a `InternetAddress` of `InternetAddressType.Unix` into + the `connect()`, `startConnect()` and `bind()` methods. The `port` argument in + those methods will be ignored. The `port` getter always returns 0 for Unix + domain sockets. -* Class `InternetAddressType` gains one more option `Unix`, which represents a - Unix domain address. +- Class `InternetAddressType` gains one more option `Unix`, which represents a + Unix domain address. -* Class `InternetAddress`: +- Class `InternetAddress`: - * `InternetAddress` constructor gains an optional `type` parameter. To - create a Unix domain address, `type` is set to - `InternetAddressType.Unix` and `address` is a file path. + - `InternetAddress` constructor gains an optional `type` parameter. To create + a Unix domain address, `type` is set to `InternetAddressType.Unix` and + `address` is a file path. - * `InternetAddress` gains a new constructor `fromRawAddress()` that takes - an address in byte format for Internet addresses or raw file path for - Unix domain addresses. + - `InternetAddress` gains a new constructor `fromRawAddress()` that takes an + address in byte format for Internet addresses or raw file path for Unix + domain addresses. -* **Breaking change** [#40681][]: The static methods `runZoned()` and - `runWithHttpOverrides()` on `HttpOverrides` no longer accept - `zoneSpecification` and `onError` parameters. Use the `runZoned()` or - `runZonedGuarded()` functions from `dart:async` directly if needing to - specify those. +- **Breaking change** [#40681][]: The static methods `runZoned()` and + `runWithHttpOverrides()` on `HttpOverrides` no longer accept + `zoneSpecification` and `onError` parameters. Use the `runZoned()` or + `runZonedGuarded()` functions from `dart:async` directly if needing to specify + those. -* Class `HttpClient` and `HttpServer`, when receiving `HttpRequest` or - `HttpClientResponse`, will now put a 8K size limit on its header fields and - values. +- Class `HttpClient` and `HttpServer`, when receiving `HttpRequest` or + `HttpClientResponse`, will now put a 8K size limit on its header fields and + values. [#33501]: https://github.com/dart-lang/sdk/issues/33501 [#40702]: https://github.com/dart-lang/sdk/issues/40702 [#40483]: https://github.com/dart-lang/sdk/issues/40483 [#40706]: https://github.com/dart-lang/sdk/issues/40706 [#40709]: https://github.com/dart-lang/sdk/issues/40709 -[RFC 7230 tokens]: https://tools.ietf.org/html/rfc7230#section-3.2.6 -[Unix domain sockets]: https://en.wikipedia.org/wiki/Unix_domain_socket +[rfc 7230 tokens]: https://tools.ietf.org/html/rfc7230#section-3.2.6 +[unix domain sockets]: https://en.wikipedia.org/wiki/Unix_domain_socket #### `dart:mirrors` -* Added `MirrorSystem.neverType`. +- Added `MirrorSystem.neverType`. ### Dart VM -* Added `Dart_TypeDynamic`, `Dart_TypeVoid` and `Dart_TypeNever`. Type - `dynamic` can no longer by reached using `Dart_GetType(dart:core, dynamic)`. +- Added `Dart_TypeDynamic`, `Dart_TypeVoid` and `Dart_TypeNever`. Type `dynamic` + can no longer by reached using `Dart_GetType(dart:core, dynamic)`. -* Added the following methods to the VM embedding API: +- Added the following methods to the VM embedding API: - * `Dart_GetNonNullableType()` - * `Dart_GetNullableType()` - * `Dart_TypeToNonNullable()` - * `Dart_TypeToNullable()` - * `Dart_IsLegacyType()` - * `Dart_IsNonNullableType()` - * `Dart_IsNullableType()` + - `Dart_GetNonNullableType()` + - `Dart_GetNullableType()` + - `Dart_TypeToNonNullable()` + - `Dart_TypeToNullable()` + - `Dart_IsLegacyType()` + - `Dart_IsNonNullableType()` + - `Dart_IsNullableType()` ### Foreign Function Interface (`dart:ffi`) -* **Breaking Change**: Changed `Pointer.asFunction()` and - `DynamicLibrary.lookupFunction()` to extension methods. Invoking them - dynamically previously already threw an exception, so the runtime behavior - stays the same. However, the extension methods are only visible if - `dart:ffi` is imported directly. This breaks code where `dart:ffi` is not - directly imported. To fix, add: +- **Breaking Change**: Changed `Pointer.asFunction()` and + `DynamicLibrary.lookupFunction()` to extension methods. Invoking them + dynamically previously already threw an exception, so the runtime behavior + stays the same. However, the extension methods are only visible if `dart:ffi` + is imported directly. This breaks code where `dart:ffi` is not directly + imported. To fix, add: - ```dart - import 'dart:ffi'; - ``` + ```dart + import 'dart:ffi'; + ``` ### Tools @@ -1315,38 +1307,38 @@ We fixed several inconsistencies between DDC and Dart2JS so that users less frequently encounter code that is accepted by one compiler but then fails in the other. -* **Breaking Change**: Deleted the legacy (analyzer based) version of DDC. For - additional details see the [announcement][ddc]. +- **Breaking Change**: Deleted the legacy (analyzer based) version of DDC. For + additional details see the [announcement][ddc]. - * The `--kernel` option is now ignored and defaults to true. There is no - longer any way to invoke the legacy (analyzer based) version of DDC. + - The `--kernel` option is now ignored and defaults to true. There is no + longer any way to invoke the legacy (analyzer based) version of DDC. - * Command line arguments that were only used for the legacy DDC have been - removed. + - Command line arguments that were only used for the legacy DDC have been + removed. - * The pre-compiled `dart_sdk.js` artifacts generated by legacy DDC have - been deleted from `dart-sdk/lib/dev_compiler` in favor of the versions - located at `dart-sdk/lib/dev_compiler/kernel`. + - The pre-compiled `dart_sdk.js` artifacts generated by legacy DDC have been + deleted from `dart-sdk/lib/dev_compiler` in favor of the versions located at + `dart-sdk/lib/dev_compiler/kernel`. -* **Breaking Change**: Functions passed to JavaScript using the recommended - `package:js` interop specification must now be wrapped with a call to - `allowInterop`. This behavior was always enforced by Dart2JS, but was not - enforced consistently by DDC. It is now enforced by both. +- **Breaking Change**: Functions passed to JavaScript using the recommended + `package:js` interop specification must now be wrapped with a call to + `allowInterop`. This behavior was always enforced by Dart2JS, but was not + enforced consistently by DDC. It is now enforced by both. -* **Breaking Change**: Constructors in `@JS()` classes must be marked with - `external`. Previously the `external` could be omitted in some cases with - DDC but doing so would cause incorrect behavior with Dart2JS. +- **Breaking Change**: Constructors in `@JS()` classes must be marked with + `external`. Previously the `external` could be omitted in some cases with DDC + but doing so would cause incorrect behavior with Dart2JS. -* JS interop classes with an index operator are now static errors. +- JS interop classes with an index operator are now static errors. -* All remaining support from the `dart:mirrors` library has been removed. Use - of this library on the web has been unsupported and prevented by the Dart - build systems since Dart v2.0.0. All known exception cases have been cleaned - up. This change makes DDC and Dart2JS now behave consistently. +- All remaining support from the `dart:mirrors` library has been removed. Use of + this library on the web has been unsupported and prevented by the Dart build + systems since Dart v2.0.0. All known exception cases have been cleaned up. + This change makes DDC and Dart2JS now behave consistently. - The library can still be imported on web apps, but all APIs throw. In a - future breaking change release, imports to this library will likely become a - compile-time error. + The library can still be imported on web apps, but all APIs throw. In a future + breaking change release, imports to this library will likely become a + compile-time error. [ddc]: https://github.com/dart-lang/sdk/issues/38994 @@ -1364,31 +1356,30 @@ non-nullable types in the near future. This change should not affect the semantics of your application, but it has some relatively small visible effects that we want to highlight: -* Types are now canonicalized, this fixes a long standing bug that Types could - not be used in switch cases (issue [17207][]). +- Types are now canonicalized, this fixes a long standing bug that Types could + not be used in switch cases (issue [17207][]). -* Code-size changes may be visible, but the difference is small overall. It is - more visible on smaller apps because the new implementation includes more - helper methods. On large apps we have even seen an overall code-size - reduction. +- Code-size changes may be visible, but the difference is small overall. It is + more visible on smaller apps because the new implementation includes more + helper methods. On large apps we have even seen an overall code-size + reduction. -* Certain checks are a lot faster. This is less noticeable if you are - compiling apps with `-O3` where checks are omitted altogether. Even with - `-O3`, the performance of some `is` checks used by your app may improve. +- Certain checks are a lot faster. This is less noticeable if you are compiling + apps with `-O3` where checks are omitted altogether. Even with `-O3`, the + performance of some `is` checks used by your app may improve. -* When using `-O3` and `-O4` incorrect type annotations could surface as - errors. The old type representation was accidentally lenient on some invalid - type annotations. We have only encountered this issue on programs that were - not tested properly at the js-interop program boundary. +- When using `-O3` and `-O4` incorrect type annotations could surface as errors. + The old type representation was accidentally lenient on some invalid type + annotations. We have only encountered this issue on programs that were not + tested properly at the js-interop program boundary. -* `Type.toString()` has a small change that is rarely visible. For a long - time, Dart2JS has had support to erase unused type variables. Today, when - Dart2JS is given `--lax-runtime-type-to-string` (currently included in - `-O2`, `-O3`, and `-O4`) and it decides to erase the type variable of a - class `Foo`, then it compiles expressions like - `foo.runtimeType.toString()` to print `Foo`. With the new representation, - this will show `Foo` instead. This change may be visible in error - messages produced by type checks involving erased types. +- `Type.toString()` has a small change that is rarely visible. For a long time, + Dart2JS has had support to erase unused type variables. Today, when Dart2JS is + given `--lax-runtime-type-to-string` (currently included in `-O2`, `-O3`, and + `-O4`) and it decides to erase the type variable of a class `Foo`, then it + compiles expressions like `foo.runtimeType.toString()` to print `Foo`. With + the new representation, this will show `Foo` instead. This change may + be visible in error messages produced by type checks involving erased types. Because types and classes are represented separately, we will likely reevaluate restrictions of deferred libraries in the near future. For example, we could @@ -1402,32 +1393,30 @@ representation soon. In addition, we fixed some inconsistencies between Dart2JS and DDC: -* JS interop classes with an index operator are now static errors instead of - causing invalid code in Dart2JS. +- JS interop classes with an index operator are now static errors instead of + causing invalid code in Dart2JS. -* **Breaking Change**: The subtyping rule for generic functions is now more - forgiving. Corresponding type parameter bounds now only need to be mutual - subtypes rather than structurally equal up to renaming of bound type - variables and equating all top types. +- **Breaking Change**: The subtyping rule for generic functions is now more + forgiving. Corresponding type parameter bounds now only need to be mutual + subtypes rather than structurally equal up to renaming of bound type variables + and equating all top types. -* **Breaking Change**: Types are now normalized. See [normalization][] for the - full specification. Types will now be printed in their normal form, and - mutual subtypes with the same normal form will now be considered equal. +- **Breaking Change**: Types are now normalized. See [normalization][] for the + full specification. Types will now be printed in their normal form, and mutual + subtypes with the same normal form will now be considered equal. -* **Breaking Change**: Constructors in `@JS()` classes must be marked with - `external`. Previously, the external could be omitted for unused - constructors. Omitting `external` for a constructor which is used would - cause incorrect behavior at runtime, now omitting it on any constructor is a - static error. +- **Breaking Change**: Constructors in `@JS()` classes must be marked with + `external`. Previously, the external could be omitted for unused constructors. + Omitting `external` for a constructor which is used would cause incorrect + behavior at runtime, now omitting it on any constructor is a static error. [17207]: https://github.com/dart-lang/sdk/issues/17207 - -[normalization]: https://github.com/dart-lang/language/blob/master/resources/type-system/normalization.md - +[normalization]: + https://github.com/dart-lang/language/blob/master/resources/type-system/normalization.md Other dart2js changes: -* **Breaking Change**: The `--package-root` flag, which was hidden and disabled +- **Breaking Change**: The `--package-root` flag, which was hidden and disabled in Dart 2.0.0, has been completely removed. Passing this flag will now cause `dart2js` to fail. @@ -1435,69 +1424,73 @@ Other dart2js changes: Updated the Linter to `0.1.114`, which includes: -* Fixed `avoid_shadowing_type_parameters` to support extensions and mixins. -* Updated `non_constant_identifier_names` to allow named constructors made up of only underscores (`_`). -* Updated `avoid_unused_constructor_parameters` to ignore unused params named in all underscores (`_`). +- Fixed `avoid_shadowing_type_parameters` to support extensions and mixins. +- Updated `non_constant_identifier_names` to allow named constructors made up of + only underscores (`_`). +- Updated `avoid_unused_constructor_parameters` to ignore unused params named in + all underscores (`_`). #### Analyzer -* Removed support for the deprecated analysis options file name - `.analysis_options`. +- Removed support for the deprecated analysis options file name + `.analysis_options`. #### Pub -* Added `pub outdated` command which lists outdated package dependencies, and - gives advice on how to upgrade. +- Added `pub outdated` command which lists outdated package dependencies, and + gives advice on how to upgrade. -* `pub get` and `pub upgrade` now fetch version information about hosted - dependencies in parallel, improving the time package resolution performance. +- `pub get` and `pub upgrade` now fetch version information about hosted + dependencies in parallel, improving the time package resolution performance. -* `pub get` and `pub upgrade` no longer precompile executables from - dependencies by default. Instead they are precompiled on first `pub run`. - Use `pub get --precompile` to get the previous behavior. +- `pub get` and `pub upgrade` no longer precompile executables from dependencies + by default. Instead they are precompiled on first `pub run`. Use + `pub get --precompile` to get the previous behavior. -* Fixed missing retries of DNS failures during `pub get`. +- Fixed missing retries of DNS failures during `pub get`. -* If code contains imports for packages not listed in the package's - `pubspec.yaml` then `pub publish` will reject the package. +- If code contains imports for packages not listed in the package's + `pubspec.yaml` then `pub publish` will reject the package. -* `pub publish` no longer requires the presence of a `homepage` field, if the - `repository` field is provided. +- `pub publish` no longer requires the presence of a `homepage` field, if the + `repository` field is provided. -* `pub publish` warns if non-pre-release packages depends on pre-release - packages or pre-release Dart SDKs. +- `pub publish` warns if non-pre-release packages depends on pre-release + packages or pre-release Dart SDKs. -* Relative paths in `pubspec.lock` now use `/` also on Windows to make the - file sharable between machines. +- Relative paths in `pubspec.lock` now use `/` also on Windows to make the file + sharable between machines. -* Fixed language version in [`.dart_tool/package_config.json`][package config] - for packages without an explicit SDK constraint. Pub now writes an empty - language version where before the language version of the current SDK would - be used. +- Fixed language version in [`.dart_tool/package_config.json`][package config] + for packages without an explicit SDK constraint. Pub now writes an empty + language version where before the language version of the current SDK would be + used. -* `%LOCALAPPDATA%` is now preferred over `%APPDATA%` when creating a pub cache - directory on Windows. `%LOCALAPPDATA%` is not copied when users roam between - devices. +- `%LOCALAPPDATA%` is now preferred over `%APPDATA%` when creating a pub cache + directory on Windows. `%LOCALAPPDATA%` is not copied when users roam between + devices. -* `pub publish` warns if LICENSE and README.md files are not called those - exact names. +- `pub publish` warns if LICENSE and README.md files are not called those exact + names. -* `pub repair cache` downloads hosted packages in parallel. +- `pub repair cache` downloads hosted packages in parallel. -[package config]: https://github.com/dart-lang/language/blob/master/accepted/future-releases/language-versioning/package-config-file-v2.md +[package config]: + https://github.com/dart-lang/language/blob/master/accepted/future-releases/language-versioning/package-config-file-v2.md ## 2.7.2 - 2020-03-23 This is a patch release that addresses a vulnerability in `dart:html` [NodeValidator][] related to DOM clobbering of `previousSibling`. See the -[vulnerability advisory][CVE-2020-8923] for more details. Thanks to **Vincenzo +[vulnerability advisory][cve-2020-8923] for more details. Thanks to **Vincenzo di Cicco** for finding and reporting this issue. This release also improves compatibility with ARMv8 processors (issue [40001][]) and dart:io stability (issue [40589][]). -[NodeValidator]: https://api.dart.dev/stable/dart-html/NodeValidator-class.html -[CVE-2020-8923]: https://github.com/dart-lang/sdk/security/advisories/GHSA-hfq3-v9pv-p627 +[nodevalidator]: https://api.dart.dev/stable/dart-html/NodeValidator-class.html +[cve-2020-8923]: + https://github.com/dart-lang/sdk/security/advisories/GHSA-hfq3-v9pv-p627 [40001]: https://github.com/dart-lang/sdk/issues/40001 [40589]: https://github.com/dart-lang/sdk/issues/40589 @@ -1507,8 +1500,8 @@ This is a patch release that improves dart2js compile-time (issue [40217][]). [40217]: https://github.com/dart-lang/sdk/issues/40217 -**Breaking Change**: -The Dart SDK for macOS is now only available for x64 (issue [39810][]). +**Breaking Change**: The Dart SDK for macOS is now only available for x64 (issue +[39810][]). [39810]: https://github.com/dart-lang/sdk/issues/39810 @@ -1522,49 +1515,50 @@ https://medium.com/dartlang/extension-methods-2d466cd8b308 ### Language -* **Breaking Change**: [Static extension members][] are accessible when -imported with a prefix (issue [671][]). In the extension method **preview** -launch, importing a library with a prefix hid all extension members in -addition to hiding the extension name, thereby making them inaccessible -in the importing library except via the explicit override syntax. Based -on user feedback, we have changed this to make extensions methods accessible -even when imported with a prefix. +- **Breaking Change**: [Static extension members][] are accessible when imported + with a prefix (issue [671][]). In the extension method **preview** launch, + importing a library with a prefix hid all extension members in addition to + hiding the extension name, thereby making them inaccessible in the importing + library except via the explicit override syntax. Based on user feedback, we + have changed this to make extensions methods accessible even when imported + with a prefix. - ```dart - // "thing.dart" - class Thing { - } - extension Show on Thing { - void show() { - print("This is a thing"); + ```dart + // "thing.dart" + class Thing { } - } - // "client.dart" - import "thing.dart" as p; - void test() { - p.Thing().show(); // Previously an error, now resolves to Show.show - } - ``` + extension Show on Thing { + void show() { + print("This is a thing"); + } + } + // "client.dart" + import "thing.dart" as p; + void test() { + p.Thing().show(); // Previously an error, now resolves to Show.show + } + ``` -[Static extension members]: https://github.com/dart-lang/language/blob/master/accepted/2.6/static-extension-members/feature-specification.md +[static extension members]: + https://github.com/dart-lang/language/blob/master/accepted/2.6/static-extension-members/feature-specification.md [671]: https://github.com/dart-lang/language/issues/671 ### Core libraries #### `dart:io` -* **Breaking change**: Added `IOOverrides.serverSocketBind` to aid in writing +- **Breaking change**: Added `IOOverrides.serverSocketBind` to aid in writing tests that wish to mock `ServerSocket.bind`. #### `dart:typed_data` -* Added new constructors, `.sublistView(TypedData, [start, end])` to all - `TypedData` classes. The constructor makes it easier, and less error-prone, - to create a view of (a slice of) another `TypedData` object. +- Added new constructors, `.sublistView(TypedData, [start, end])` to all + `TypedData` classes. The constructor makes it easier, and less error-prone, to + create a view of (a slice of) another `TypedData` object. ### Dart VM -* New fields added to existing instances by a reload will now be initialized +- New fields added to existing instances by a reload will now be initialized lazily, as if the field was a late field. This makes the initialization order program-defined, whereas previously it was undefined. @@ -1574,21 +1568,24 @@ even when imported with a prefix. The Linter was updated to `0.1.104`, which includes: -* updated `unnecessary_overrides` to allow overrides when annotations (besides `@override` are specified) -* updated `file_names` to allow names w/ leading `_`'s (and improved performance) -* new lint: `unnecessary_final` +- updated `unnecessary_overrides` to allow overrides when annotations (besides + `@override` are specified) +- updated `file_names` to allow names w/ leading `_`'s (and improved + performance) +- new lint: `unnecessary_final` #### Pub -* `pub get` generates [`.dart_tool/package_config.json`](https://github.com/dart-lang/language/blob/62c036cc41b10fb543102d2f73ee132d1e2b2a0e/accepted/future-releases/language-versioning/package-config-file-v2.md) +- `pub get` generates + [`.dart_tool/package_config.json`](https://github.com/dart-lang/language/blob/62c036cc41b10fb543102d2f73ee132d1e2b2a0e/accepted/future-releases/language-versioning/package-config-file-v2.md) in addition to `.packages` to support language versioning. -* `pub publish` now warns about the old flutter plugin registration format. +- `pub publish` now warns about the old flutter plugin registration format. -* `pub publish` now warns about the `author` field in pubspec.yaml being. +- `pub publish` now warns about the `author` field in pubspec.yaml being. obsolete. -* Show a proper error message when `git` is not installed. +- Show a proper error message when `git` is not installed. ## 2.6.1 - 2019-11-11 @@ -1603,123 +1600,123 @@ documentation. ### Language -* **[IN PREVIEW]** [Static extension members][]: A new language feature - allowing specially declared static functions to be invoked like instance - members on expressions of appropriate static types is available in preview. +- **[IN PREVIEW]** [Static extension members][]: A new language feature allowing + specially declared static functions to be invoked like instance members on + expressions of appropriate static types is available in preview. - Static extension members are declared using a new `extension` declaration. - Example: + Static extension members are declared using a new `extension` declaration. + Example: - ```dart - extension MyFancyList on List { - /// Whether this list has an even length. - bool get isLengthEven => this.length.isEven; + ```dart + extension MyFancyList on List { + /// Whether this list has an even length. + bool get isLengthEven => this.length.isEven; - /// Whether this list has an odd length. - bool get isLengthOdd => !isLengthEven; + /// Whether this list has an odd length. + bool get isLengthOdd => !isLengthEven; - /// List of values computed for each pairs of adjacent elements. - /// - /// The result always has one element less than this list, - /// if this list has any elements. - List combinePairs(R Function(T, T) combine) => - [for (int i = 1; i < this.length; i++) - combine(this[i - 1], this[i])]; + /// List of values computed for each pairs of adjacent elements. + /// + /// The result always has one element less than this list, + /// if this list has any elements. + List combinePairs(R Function(T, T) combine) => + [for (int i = 1; i < this.length; i++) + combine(this[i - 1], this[i])]; + } + ``` + + Extension declarations cannot declare instance fields or constructors. + Extension members can be invoked explicitly, + `MyFancyList(intList).isLengthEven)`, or implicitly, `intList.isLengthEven`, + where the latter is recognized by `intList` matching the `List` "on" type + of the declaration. An extension member cannot be called implicitly on an + expression whose static type has a member with the same base-name. In that + case, the interface member takes precedence. If multiple extension members + apply to the same implicit invocation, the most specific one is used, if there + is one such. + + Extensions can be declared on any type, not just interface types. + + ```dart + extension IntCounter on int { + /// The numbers from this number to, but not including, [end]. + Iterable to(int end) sync* { + int step = end < this ? -1 : 1; + for (int i = this; i != end; i += step) yield i; } - ``` + } - Extension declarations cannot declare instance fields or constructors. - Extension members can be invoked explicitly, - `MyFancyList(intList).isLengthEven)`, or implicitly, `intList.isLengthEven`, - where the latter is recognized by `intList` matching the `List` "on" type - of the declaration. An extension member cannot be called implicitly on an - expression whose static type has a member with the same base-name. In that - case, the interface member takes precedence. If multiple extension members - apply to the same implicit invocation, the most specific one is used, if - there is one such. + extension CurryFunction on R Function(S, T) { + /// Curry a binary function with its first argument. + R Function(T) curry(S first) => (T second) => this(first, second); + } + ``` - Extensions can be declared on any type, not just interface types. + [static extension members]: + https://github.com/dart-lang/language/blob/master/accepted/2.6/static-extension-members/feature-specification.md - ```dart - extension IntCounter on int { - /// The numbers from this number to, but not including, [end]. - Iterable to(int end) sync* { - int step = end < this ? -1 : 1; - for (int i = this; i != end; i += step) yield i; - } - } +- **Breaking change** [#37985](https://github.com/dart-lang/sdk/issues/37985): + Inference is changed when using `Null` values in a `FutureOr` context. Namely, + constraints of the forms similar to `Null` <: `FutureOr` now yield `Null` + as the solution for `T`. For example, the following code will now print + "Null", and it was printing "dynamic" before (note that the anonymous closure + `() {}` in the example has `Null` as its return type): - extension CurryFunction on R Function(S, T) { - /// Curry a binary function with its first argument. - R Function(T) curry(S first) => (T second) => this(first, second); - } - ``` + ```dart + import 'dart:async'; - [Static extension members]: https://github.com/dart-lang/language/blob/master/accepted/2.6/static-extension-members/feature-specification.md - -* **Breaking change** [#37985](https://github.com/dart-lang/sdk/issues/37985): - Inference is changed when using `Null` values in a `FutureOr` context. - Namely, constraints of the forms similar to `Null` <: `FutureOr` now - yield `Null` as the solution for `T`. For example, the following code will - now print "Null", and it was printing "dynamic" before (note that the - anonymous closure `() {}` in the example has `Null` as its return type): - - ```dart - import 'dart:async'; - - void foo(FutureOr Function() f) { print(T); } - - main() { foo(() {}); } - ``` + void foo(FutureOr Function() f) { print(T); } + main() { foo(() {}); } + ``` ### Core libraries -* Default values of parameters of abstract methods are no longer available - via `dart:mirrors`. +- Default values of parameters of abstract methods are no longer available via + `dart:mirrors`. #### `dart:developer` -* Added optional `parent` parameter to `TimelineTask` constructor to allow for +- Added optional `parent` parameter to `TimelineTask` constructor to allow for linking of asynchronous timeline events in the DevTools timeline view. #### `dart:io` -* Added `enableTimelineLogging` property to `HttpClient` which, when enabled, +- Added `enableTimelineLogging` property to `HttpClient` which, when enabled, will post HTTP connection and request information to the developer timeline for all `HttpClient` instances. ### Dart VM -* Added a new tool for AOT compiling Dart programs to native, self-contained -executables. See https://dart.dev/tools/dart2native for additional details. +- Added a new tool for AOT compiling Dart programs to native, self-contained + executables. See https://dart.dev/tools/dart2native for additional details. ### Foreign Function Interface (`dart:ffi`) -* **Breaking change**: The API now makes use of static extension members. - Static extension members enable the `dart:ffi` API to be more precise with - types, and provide convenient access to memory through extension getters and - setters. The extension members on `Pointer` provide `.value` and `.value =` - for accessing the value in native memory and `[]` and `[]=` for indexed access. - The method `asExternalTypedData` has been replaced with `asTypedList` extension - methods. And finally, `Structs` do no longer have a type argument and are - accessed using the extension member `.ref` on `Pointer`. - These changes makes the code using `dart:ffi` much more concise. -* **Breaking change**: The memory management has been removed (`Pointer.allocate` - and `Pointer.free`). Instead, memory management is available in - [package:ffi](https://pub.dev/packages/ffi). -* **Breaking change**: `Pointer.offsetBy` was removed, use `cast` and `elementAt` - instead. -* Faster memory load and stores. -* The dartanalyzer (commandline and IDEs) now reports `dart:ffi` static errors. -* Callbacks are now supported in AOT (ahead-of-time) compiled code. +- **Breaking change**: The API now makes use of static extension members. Static + extension members enable the `dart:ffi` API to be more precise with types, and + provide convenient access to memory through extension getters and setters. The + extension members on `Pointer` provide `.value` and `.value =` for accessing + the value in native memory and `[]` and `[]=` for indexed access. The method + `asExternalTypedData` has been replaced with `asTypedList` extension methods. + And finally, `Structs` do no longer have a type argument and are accessed + using the extension member `.ref` on `Pointer`. These changes makes the code + using `dart:ffi` much more concise. +- **Breaking change**: The memory management has been removed + (`Pointer.allocate` and `Pointer.free`). Instead, memory management is + available in [package:ffi](https://pub.dev/packages/ffi). +- **Breaking change**: `Pointer.offsetBy` was removed, use `cast` and + `elementAt` instead. +- Faster memory load and stores. +- The dartanalyzer (commandline and IDEs) now reports `dart:ffi` static errors. +- Callbacks are now supported in AOT (ahead-of-time) compiled code. ### Dart for the Web #### Dart Dev Compiler (DDC) -* Kernel DDC will no longer accept non-dill files as summary inputs. -* Removed support for the deprecated web extension. +- Kernel DDC will no longer accept non-dill files as summary inputs. +- Removed support for the deprecated web extension. ### Tools @@ -1727,11 +1724,14 @@ executables. See https://dart.dev/tools/dart2native for additional details. The Linter was updated to `0.1.101`, which includes: -* fixed `diagnostic_describe_all_properties` to flag properties in `Diagnosticable`s with no debug methods defined -* fixed `noSuchMethod` exception in `camel_case_extensions` when analyzing unnamed extensions -* fixed `avoid_print` to catch tear-off usage -* new lint: `avoid_web_libraries_in_flutter` (experimental) -* (internal) prepare `unnecessary_lambdas` for coming `MethodInvocation` vs. `FunctionExpressionInvocation` changes +- fixed `diagnostic_describe_all_properties` to flag properties in + `Diagnosticable`s with no debug methods defined +- fixed `noSuchMethod` exception in `camel_case_extensions` when analyzing + unnamed extensions +- fixed `avoid_print` to catch tear-off usage +- new lint: `avoid_web_libraries_in_flutter` (experimental) +- (internal) prepare `unnecessary_lambdas` for coming `MethodInvocation` vs. + `FunctionExpressionInvocation` changes ## 2.5.2 - 2019-10-08 @@ -1752,20 +1752,20 @@ This is a patch release that prevents type inference failures in the analyzer ### Language The set of operations allowed in constant expressions has been expanded as -described in -the [constant update proposal](https://github.com/dart-lang/language/issues/61). -The control flow and spread collection features shipped in Dart 2.3 are now also -supported in constants -as +described in the +[constant update proposal](https://github.com/dart-lang/language/issues/61). The +control flow and spread collection features shipped in Dart 2.3 are now also +supported in constants as [described in the specification here](https://github.com/dart-lang/language/blob/master/accepted/2.3/unified-collections/feature-specification.md#constant-semantics). Specifically, it is now valid to use the following operations in constant expressions under the appropriate conditions: - - Casts (`e as T`) and type tests (`e is T`). - - Comparisons to `null`, even for types which override the `==` operator. - - The `&`, `|`, and `^` binary operators on booleans. - - The spread operators (`...` and `...?`). - - An `if` element in a collection literal. + +- Casts (`e as T`) and type tests (`e is T`). +- Comparisons to `null`, even for types which override the `==` operator. +- The `&`, `|`, and `^` binary operators on booleans. +- The spread operators (`...` and `...?`). +- An `if` element in a collection literal. ```dart // Example: these are now valid constants. @@ -1776,14 +1776,15 @@ const map = {if (i is int) i : "int"}; ``` In addition, the semantics of constant evaluation has been changed as follows: - - The `&&` operator only evaluates its second operand if the first evaluates - to true. - - The `||` operator only evaluates its second operand if the first evaluates - to false. - - The `??` operator only evaluates its second operand if the first evaluates - to null. - - The conditional operator (`e ? e1 : e2`) only evaluates one of the two - branches, depending on the value of the first operand. + +- The `&&` operator only evaluates its second operand if the first evaluates to + true. +- The `||` operator only evaluates its second operand if the first evaluates to + false. +- The `??` operator only evaluates its second operand if the first evaluates to + null. +- The conditional operator (`e ? e1 : e2`) only evaluates one of the two + branches, depending on the value of the first operand. ```dart // Example: x is now a valid constant definition. @@ -1793,88 +1794,92 @@ const int x = (s == null) ? 0 : s.length; ### Core libraries -* **Breaking change** [#36900](https://github.com/dart-lang/sdk/issues/36900): - The following methods and - properties across various core libraries, which used to declare a return type - of `List`, were updated to declare a return type of `Uint8List`: +- **Breaking change** [#36900](https://github.com/dart-lang/sdk/issues/36900): + The following methods and properties across various core libraries, which used + to declare a return type of `List`, were updated to declare a return type + of `Uint8List`: - * `BytesBuilder.takeBytes()` - * `BytesBuilder.toBytes()` - * `Datagram.data` - * `File.readAsBytes()` (`Future`) - * `File.readAsBytesSync()` - * `InternetAddress.rawAddress` - * `RandomAccessFile.read()` (`Future`) - * `RandomAccessFile.readSync()` - * `RawSocket.read()` - * `Utf8Codec.encode()` (and `Utf8Encoder.convert()`) + - `BytesBuilder.takeBytes()` + - `BytesBuilder.toBytes()` + - `Datagram.data` + - `File.readAsBytes()` (`Future`) + - `File.readAsBytesSync()` + - `InternetAddress.rawAddress` + - `RandomAccessFile.read()` (`Future`) + - `RandomAccessFile.readSync()` + - `RawSocket.read()` + - `Utf8Codec.encode()` (and `Utf8Encoder.convert()`) In addition, the following classes were updated to implement `Stream` rather than `Stream>`: - * `HttpRequest` - * `Socket` + - `HttpRequest` + - `Socket` **Possible errors and how to fix them** - * > The argument type 'Utf8Decoder' can't be assigned to the parameter type 'StreamTransformer' + - > The argument type 'Utf8Decoder' can't be assigned to the parameter type + > 'StreamTransformer' - > type 'Utf8Decoder' is not a subtype of type 'StreamTransformer' of 'streamTransformer'" + > type 'Utf8Decoder' is not a subtype of type 'StreamTransformer' of + > 'streamTransformer'" - You can fix these call sites by updating your code to use - `StreamTransformer.bind()` instead of `Stream.transform()`, like so: + You can fix these call sites by updating your code to use + `StreamTransformer.bind()` instead of `Stream.transform()`, like so: - *Before:* `stream.transform(utf8.decoder)` - *After:* `utf8.decoder.bind(stream)` + _Before:_ `stream.transform(utf8.decoder)` _After:_ + `utf8.decoder.bind(stream)` - * > The argument type 'IOSink' can't be assigned to the parameter type 'StreamConsumer' + - > The argument type 'IOSink' can't be assigned to the parameter type + > 'StreamConsumer' - > type '_IOSinkImpl' is not a subtype of type 'StreamConsumer' of 'streamConsumer' + > type '\_IOSinkImpl' is not a subtype of type 'StreamConsumer' + > of 'streamConsumer' - You can fix these call sites by casting your stream instance to a `Stream>` before calling `.pipe()` on the stream, like so: + You can fix these call sites by casting your stream instance to a + `Stream>` before calling `.pipe()` on the stream, like so: - *Before:* `stream.pipe(consumer)` - *After:* `stream.cast>().pipe(consumer)` + _Before:_ `stream.pipe(consumer)` _After:_ + `stream.cast>().pipe(consumer)` Finally, the following typed lists were updated to have their `sublist()` methods declare a return type that is the same as the source list: - * `Int8List.sublist()` → `Int8List` - * `Int16List.sublist()` → `Int16List` - * `Int32List.sublist()` → `Int32List` - * `Int64List.sublist()` → `Int64List` - * `Int32x4List.sublist()` → `Int32x4List` - * `Float32List.sublist()` → `Float32List` - * `Float64List.sublist()` → `Float64List` - * `Float32x4List.sublist()` → `Float32x4List` - * `Float64x2List.sublist()` → `Float64x2List` - * `Uint8List.sublist()` → `Uint8List` - * `Uint8ClampedList.sublist()` → `Uint8ClampedList` - * `Uint16List.sublist()` → `Uint16List` - * `Uint32List.sublist()` → `Uint32List` - * `Uint64List.sublist()` → `Uint64List` + - `Int8List.sublist()` → `Int8List` + - `Int16List.sublist()` → `Int16List` + - `Int32List.sublist()` → `Int32List` + - `Int64List.sublist()` → `Int64List` + - `Int32x4List.sublist()` → `Int32x4List` + - `Float32List.sublist()` → `Float32List` + - `Float64List.sublist()` → `Float64List` + - `Float32x4List.sublist()` → `Float32x4List` + - `Float64x2List.sublist()` → `Float64x2List` + - `Uint8List.sublist()` → `Uint8List` + - `Uint8ClampedList.sublist()` → `Uint8ClampedList` + - `Uint16List.sublist()` → `Uint16List` + - `Uint32List.sublist()` → `Uint32List` + - `Uint64List.sublist()` → `Uint64List` #### `dart:async` -* Add `value` and `error` constructors on `Stream` - to allow easily creating single-value or single-error streams. +- Add `value` and `error` constructors on `Stream` to allow easily creating + single-value or single-error streams. #### `dart:core` -* Update `Uri` class to support [RFC6874](https://tools.ietf.org/html/rfc6874): +- Update `Uri` class to support [RFC6874](https://tools.ietf.org/html/rfc6874): "%25" or "%" can be appended to the end of a valid IPv6 representing a Zone Identifier. A valid zone ID consists of unreversed character or Percent - encoded octet, which was defined in RFC3986. - IPv6addrz = IPv6address "%25" ZoneID + encoded octet, which was defined in RFC3986. IPv6addrz = IPv6address "%25" + ZoneID [29456]: https://github.com/dart-lang/sdk/issues/29456 #### `dart:io` -* **Breaking change** [#37192](https://github.com/dart-lang/sdk/issues/37192): - The `Cookie` class's constructor's `name` and `value` - optional positional parameters are now mandatory. The - signature changes from: +- **Breaking change** [#37192](https://github.com/dart-lang/sdk/issues/37192): + The `Cookie` class's constructor's `name` and `value` optional positional + parameters are now mandatory. The signature changes from: Cookie([String name, String value]) @@ -1889,11 +1894,11 @@ const int x = (s == null) ? 0 : s.length; Since code could not previously correctly omit the parameters, this is not really a breaking change. -* **Breaking change** [#37192](https://github.com/dart-lang/sdk/issues/37192): - The `Cookie` class's `name` and `value` setters now - validates that the strings are made from the allowed character set and are not - null. The constructor already made these checks and this - fixes the loophole where the setters didn't also validate. +- **Breaking change** [#37192](https://github.com/dart-lang/sdk/issues/37192): + The `Cookie` class's `name` and `value` setters now validates that the strings + are made from the allowed character set and are not null. The constructor + already made these checks and this fixes the loophole where the setters didn't + also validate. ### Dart VM @@ -1901,35 +1906,35 @@ const int x = (s == null) ? 0 : s.length; #### Pub - * Clean-up invalid git repositories in cache when fetching from git. - * **Breaking change** [#36765](https://github.com/dart-lang/sdk/issues/36765): - Packages published to [pub.dev](https://pub.dev) can no longer contain git - dependencies. These packages will be rejected by the server. +- Clean-up invalid git repositories in cache when fetching from git. +- **Breaking change** [#36765](https://github.com/dart-lang/sdk/issues/36765): + Packages published to [pub.dev](https://pub.dev) can no longer contain git + dependencies. These packages will be rejected by the server. #### Linter The Linter was updated to `0.1.96`, which includes: -* fixed false positives in `unnecessary_parens` -* various changes to migrate to preferred analyzer APIs -* rule test fixes +- fixed false positives in `unnecessary_parens` +- various changes to migrate to preferred analyzer APIs +- rule test fixes #### Dartdoc -Dartdoc was updated to `0.28.4`; this version includes several fixes and is based -on a newer version of the analyzer package. +Dartdoc was updated to `0.28.4`; this version includes several fixes and is +based on a newer version of the analyzer package. ## 2.4.1 - 2019-08-07 -This is a patch release that fixes a performance regression in JIT mode, as -well as a potential crash of our AOT compiler. +This is a patch release that fixes a performance regression in JIT mode, as well +as a potential crash of our AOT compiler. ### Dart VM -* Fixed a performance regression where usage of `Int32List` could trigger +- Fixed a performance regression where usage of `Int32List` could trigger repeated deoptimizations in JIT mode (Issue [37551][]). -* Fixed a bug where usage of a static getter with name `length` could cause a +- Fixed a bug where usage of a static getter with name `length` could cause a crash in our AOT compiler (Issue [35121][]). [37551]: https://github.com/dart-lang/sdk/issues/37551 @@ -1950,10 +1955,10 @@ failing. This changes makes DDC behave more like dart2js with the default flags. #### `dart:isolate` -* `TransferableTypedData` class was added to facilitate faster cross-isolate -communication of `Uint8List` data. +- `TransferableTypedData` class was added to facilitate faster cross-isolate + communication of `Uint8List` data. -* **Breaking change**: `Isolate.resolvePackageUri` will always throw an +- **Breaking change**: `Isolate.resolvePackageUri` will always throw an `UnsupportedError` when compiled with dart2js or DDC. This was the only remaining API in `dart:isolate` that didn't automatically throw since we dropped support for this library in [Dart 2.0.0][1]. Note that the API already @@ -1962,26 +1967,26 @@ communication of `Uint8List` data. [1]: https://github.com/dart-lang/sdk/blob/master/CHANGELOG.md#200---2018-08-07 - #### `dart:developer` -* Exposed `result`, `errorCode` and `errorDetail` getters in + +- Exposed `result`, `errorCode` and `errorDetail` getters in `ServiceExtensionResponse` to allow for better debugging of VM service extension RPC results. #### `dart:io` -* Fixed `Cookie` class interoperability with certain websites by allowing the +- Fixed `Cookie` class interoperability with certain websites by allowing the cookie values to be the empty string (Issue [35804][]) and not stripping double quotes from the value (Issue [33327][]) in accordance with RFC 6265. [33327]: https://github.com/dart-lang/sdk/issues/33327 [35804]: https://github.com/dart-lang/sdk/issues/35804 -* [#36971](https://github.com/dart-lang/sdk/issues/36971): - The `HttpClientResponse` interface has been extended with the addition of a - new `compressionState` getter, which specifies whether the body of a - response was compressed when it was received and whether it has been - automatically uncompressed via `HttpClient.autoUncompress`. +- [#36971](https://github.com/dart-lang/sdk/issues/36971): The + `HttpClientResponse` interface has been extended with the addition of a new + `compressionState` getter, which specifies whether the body of a response was + compressed when it was received and whether it has been automatically + uncompressed via `HttpClient.autoUncompress`. As part of this change, a corresponding new enum was added to `dart:io`: `HttpClientResponseCompressionState`. @@ -1991,30 +1996,29 @@ communication of `Uint8List` data. #### `dart:async` -* **Breaking change** [#36382](https://github.com/dart-lang/sdk/issues/36382): - The `await for` allowed `null` as a stream due to a bug - in `StreamIterator` class. This bug has now been fixed. +- **Breaking change** [#36382](https://github.com/dart-lang/sdk/issues/36382): + The `await for` allowed `null` as a stream due to a bug in `StreamIterator` + class. This bug has now been fixed. #### `dart:core` -* [#36171](https://github.com/dart-lang/sdk/issues/36171): - The `RegExp` interface has been extended with two new - constructor named parameters: +- [#36171](https://github.com/dart-lang/sdk/issues/36171): The `RegExp` + interface has been extended with two new constructor named parameters: - * `unicode:` (`bool`, default: `false`), for Unicode patterns - * `dotAll:` (`bool`, default: `false`), to change the matching behavior of - '.' to also match line terminating characters. + - `unicode:` (`bool`, default: `false`), for Unicode patterns + - `dotAll:` (`bool`, default: `false`), to change the matching behavior of '.' + to also match line terminating characters. Appropriate properties for these named parameters have also been added so their use can be detected after construction. - In addition, `RegExp` methods that originally returned `Match` objects - now return a more specific subtype, `RegExpMatch`, which adds two features: + In addition, `RegExp` methods that originally returned `Match` objects now + return a more specific subtype, `RegExpMatch`, which adds two features: - * `Iterable groupNames`, a property that contains the names of all + - `Iterable groupNames`, a property that contains the names of all named capture groups - * `String namedGroup(String name)`, a method that retrieves the match for - the given named capture group + - `String namedGroup(String name)`, a method that retrieves the match for the + given named capture group This is a **breaking change** for implementers of the `RegExp` interface. Subclasses will need to add the new properties and may have to update the @@ -2022,31 +2026,30 @@ communication of `Uint8List` data. ### Language -* **Breaking change** [#35097](https://github.com/dart-lang/sdk/issues/35097): - Covariance of type variables used in super-interfaces - is now enforced. For example, the following code was - previously accepted and will now be rejected: +- **Breaking change** [#35097](https://github.com/dart-lang/sdk/issues/35097): + Covariance of type variables used in super-interfaces is now enforced. For + example, the following code was previously accepted and will now be rejected: ```dart class A {}; class B extends A {}; ``` -* The identifier `async` can now be used in asynchronous and generator +- The identifier `async` can now be used in asynchronous and generator functions. ### Dart for the Web #### Dart Dev Compiler (DDC) -* Improve `NoSuchMethod` errors for failing dynamic calls. Now they include +- Improve `NoSuchMethod` errors for failing dynamic calls. Now they include specific information about the nature of the error such as: - * Attempting to call a null value. - * Calling an object instance with a null `call()` method. - * Passing too few or too many arguments. - * Passing incorrect named arguments. - * Passing too few or too many type arguments. - * Passing type arguments to a non-generic method. + - Attempting to call a null value. + - Calling an object instance with a null `call()` method. + - Passing too few or too many arguments. + - Passing incorrect named arguments. + - Passing too few or too many type arguments. + - Passing type arguments to a non-generic method. ### Tools @@ -2054,26 +2057,27 @@ class B extends A {}; The Linter was updated to `0.1.91`, which includes the following changes: -* Fixed missed cases in `prefer_const_constructors` -* Fixed `prefer_initializing_formals` to no longer suggest API breaking changes -* Updated `omit_local_variable_types` to allow explicit `dynamic`s -* Fixed null-reference in `unrelated_type_equality_checks` -* New lint: `unsafe_html` -* Broadened `prefer_null_aware_operators` to work beyond local variables. -* Added `prefer_if_null_operators`. -* Fixed `prefer_contains` false positives. -* Fixed `unnecessary_parenthesis` false positives. -* Fixed `prefer_asserts_in_initializer_lists` false positives -* Fixed `curly_braces_in_flow_control_structures` to handle more cases -* New lint: `prefer_double_quotes` -* New lint: `sort_child_properties_last` -* Fixed `type_annotate_public_apis` false positive for `static const` initializers +- Fixed missed cases in `prefer_const_constructors` +- Fixed `prefer_initializing_formals` to no longer suggest API breaking changes +- Updated `omit_local_variable_types` to allow explicit `dynamic`s +- Fixed null-reference in `unrelated_type_equality_checks` +- New lint: `unsafe_html` +- Broadened `prefer_null_aware_operators` to work beyond local variables. +- Added `prefer_if_null_operators`. +- Fixed `prefer_contains` false positives. +- Fixed `unnecessary_parenthesis` false positives. +- Fixed `prefer_asserts_in_initializer_lists` false positives +- Fixed `curly_braces_in_flow_control_structures` to handle more cases +- New lint: `prefer_double_quotes` +- New lint: `sort_child_properties_last` +- Fixed `type_annotate_public_apis` false positive for `static const` + initializers #### Pub -* `pub publish` will no longer warn about missing dependencies for import - statements in `example/`. -* OAuth2 authentication will explicitly ask for the `openid` scope. +- `pub publish` will no longer warn about missing dependencies for import + statements in `example/`. +- OAuth2 authentication will explicitly ask for the `openid` scope. ## 2.3.2 - 2019-06-11 @@ -2081,28 +2085,28 @@ This is a patch version release with a security improvement. ### Security vulnerability -* **Security improvement:** On Linux and Android, starting a process with - `Process.run`, `Process.runSync`, or `Process.start` would first search the - current directory before searching `PATH` (Issue [37101][]). This behavior - effectively put the current working directory in the front of `PATH`, even if - it wasn't in the `PATH`. This release changes that behavior to only searching - the directories in the `PATH` environment variable. Operating systems other - than Linux and Android didn't have this behavior and aren't affected by this - vulnerability. +- **Security improvement:** On Linux and Android, starting a process with + `Process.run`, `Process.runSync`, or `Process.start` would first search the + current directory before searching `PATH` (Issue [37101][]). This behavior + effectively put the current working directory in the front of `PATH`, even if + it wasn't in the `PATH`. This release changes that behavior to only searching + the directories in the `PATH` environment variable. Operating systems other + than Linux and Android didn't have this behavior and aren't affected by this + vulnerability. - This vulnerability could result in execution of untrusted code if a command - without a slash in its name was run inside an untrusted directory containing - an executable file with that name: + This vulnerability could result in execution of untrusted code if a command + without a slash in its name was run inside an untrusted directory containing + an executable file with that name: - ```dart - Process.run("ls", workingDirectory: "/untrusted/directory") - ``` + ```dart + Process.run("ls", workingDirectory: "/untrusted/directory") + ``` - This would attempt to run `/untrusted/directory/ls` if it existed, even - though it is not in the `PATH`. It was always safe to instead use an absolute - path or a path containing a slash. + This would attempt to run `/untrusted/directory/ls` if it existed, even though + it is not in the `PATH`. It was always safe to instead use an absolute path or + a path containing a slash. - This vulnerability was introduced in Dart 2.0.0. + This vulnerability was introduced in Dart 2.0.0. [37101]: https://github.com/dart-lang/sdk/issues/37101 @@ -2114,7 +2118,7 @@ This is a patch version release with bug fixes. #### dart2js -* Fixed a bug that caused the compiler to crash when it compiled UI-as-code +- Fixed a bug that caused the compiler to crash when it compiled UI-as-code features within fields (Issue [36864][]). [36864]: https://github.com/dart-lang/sdk/issues/36864 @@ -2133,7 +2137,8 @@ large component, so we focused on three features to make collections more powerful. We'll use list literals in the examples below, but these features also work in map and set literals. -[ui-as-code]: https://medium.com/dartlang/making-dart-a-better-language-for-ui-f1ccaf9f546c +[ui-as-code]: + https://medium.com/dartlang/making-dart-a-better-language-for-ui-f1ccaf9f546c #### Spread @@ -2259,9 +2264,10 @@ var command = [ As you can see, all three of these features can be freely composed. For full details of the changes, see [the official proposal][ui-as-code proposal]. -[ui-as-code proposal]: https://github.com/dart-lang/language/blob/master/accepted/future-releases/unified-collections/feature-specification.md +[ui-as-code proposal]: + https://github.com/dart-lang/language/blob/master/accepted/future-releases/unified-collections/feature-specification.md -**Note: These features are not currently supported in *const* collection +**Note: These features are not currently supported in _const_ collection literals. In a future release, we intend to relax this restriction and allow spread and collection `if` inside const collections.** @@ -2269,26 +2275,25 @@ spread and collection `if` inside const collections.** #### `dart:isolate` -* Added `debugName` property to `Isolate`. -* Added `debugName` optional parameter to `Isolate.spawn` and - `Isolate.spawnUri`. +- Added `debugName` property to `Isolate`. +- Added `debugName` optional parameter to `Isolate.spawn` and + `Isolate.spawnUri`. #### `dart:core` -* RegExp patterns can now use lookbehind assertions. -* RegExp patterns can now use named capture groups and named backreferences. - Currently, named group matches can only be retrieved in Dart either by the - implicit index of the named group or by downcasting the returned Match - object to the type RegExpMatch. The RegExpMatch interface contains methods - for retrieving the available group names and retrieving a match by group - name. +- RegExp patterns can now use lookbehind assertions. +- RegExp patterns can now use named capture groups and named backreferences. + Currently, named group matches can only be retrieved in Dart either by the + implicit index of the named group or by downcasting the returned Match object + to the type RegExpMatch. The RegExpMatch interface contains methods for + retrieving the available group names and retrieving a match by group name. ### Dart VM -* The VM service now requires an authentication code by default. This behavior - can be disabled by providing the `--disable-service-auth-codes` flag. +- The VM service now requires an authentication code by default. This behavior + can be disabled by providing the `--disable-service-auth-codes` flag. -* Support for deprecated flags '-c' and '--checked' has been removed. +- Support for deprecated flags '-c' and '--checked' has been removed. ### Dart for the Web @@ -2304,21 +2309,21 @@ To use the binary format today, use `--dump-info=binary`, instead of What to expect next? -* The [visualizer tool][visualizer] will not be updated to support the new - binary format, but you can find several command-line tools at - `package:dart2js_info` that provide similar features to those in the - visualizer. +- The [visualizer tool][visualizer] will not be updated to support the new + binary format, but you can find several command-line tools at + `package:dart2js_info` that provide similar features to those in the + visualizer. -* The command-line tools in `package:dart2js_info` also work with the old JSON - format, so you can start using them even before you enable the new format. +- The command-line tools in `package:dart2js_info` also work with the old JSON + format, so you can start using them even before you enable the new format. -* In a future release `--dump-info` will default to `--dump-info=binary`. At - that point, there will be an option to fallback to the JSON format, but the - visualizer tool will be deprecated. +- In a future release `--dump-info` will default to `--dump-info=binary`. At + that point, there will be an option to fallback to the JSON format, but the + visualizer tool will be deprecated. -* A release after that, the JSON format will no longer be available from - dart2js, but may be available from a command-line tool in - `package:dart2js_info`. +- A release after that, the JSON format will no longer be available from + dart2js, but may be available from a command-line tool in + `package:dart2js_info`. [visualizer]: https://dart-lang.github.io/dump-info-visualizer/ @@ -2326,40 +2331,40 @@ What to expect next? #### dartfmt -* Tweak set literal formatting to follow other collection literals. -* Add support for "UI as code" features. -* Properly format trailing commas in assertions. -* Improve indentation of adjacent strings in argument lists. +- Tweak set literal formatting to follow other collection literals. +- Add support for "UI as code" features. +- Properly format trailing commas in assertions. +- Improve indentation of adjacent strings in argument lists. #### Linter The Linter was updated to `0.1.86`, which includes the following changes: -* Added the following lints: `prefer_inlined_adds`, - `prefer_for_elements_to_map_fromIterable`, - `prefer_if_elements_to_conditional_expressions`, - `diagnostic_describe_all_properties`. -* Updated `file_names` to skip prefixed-extension Dart files (`.css.dart`, +- Added the following lints: `prefer_inlined_adds`, + `prefer_for_elements_to_map_fromIterable`, + `prefer_if_elements_to_conditional_expressions`, + `diagnostic_describe_all_properties`. +- Updated `file_names` to skip prefixed-extension Dart files (`.css.dart`, `.g.dart`, etc.). -* Fixed false positives in `unnecessary_parenthesis`. +- Fixed false positives in `unnecessary_parenthesis`. #### Pub -* Added a CHANGELOG validator that complains if you `pub publish` without - mentioning the current version. -* Removed validation of library names when doing `pub publish`. -* Added support for `pub global activate`ing package from a custom pub URL. -* Added subcommand: `pub logout`. Logs you out of the current session. +- Added a CHANGELOG validator that complains if you `pub publish` without + mentioning the current version. +- Removed validation of library names when doing `pub publish`. +- Added support for `pub global activate`ing package from a custom pub URL. +- Added subcommand: `pub logout`. Logs you out of the current session. #### Dart native Initial support for compiling Dart apps to native machine code has been added. Two new tools have been added to the `bin` folder of the Dart SDK: -* `dart2aot`: AOT (ahead-of-time) compiles a Dart program to native -machine code. The tool is supported on Windows, macOS, and Linux. +- `dart2aot`: AOT (ahead-of-time) compiles a Dart program to native machine + code. The tool is supported on Windows, macOS, and Linux. -* `dartaotruntime`: A small runtime used for executing an AOT compiled program. +- `dartaotruntime`: A small runtime used for executing an AOT compiled program. ## 2.2.0 - 2019-02-26 @@ -2377,9 +2382,9 @@ Using curly braces makes empty sets ambiguous with maps: var collection = {}; // Empty set or map? ``` -To avoid breaking existing code, an ambiguous literal is treated as a map. -To create an empty set, you can rely on either a surrounding context type -or an explicit type argument: +To avoid breaking existing code, an ambiguous literal is treated as a map. To +create an empty set, you can rely on either a surrounding context type or an +explicit type argument: ```dart // Variable type forces this to be a set: @@ -2396,41 +2401,41 @@ has been disabled. #### Analyzer -* The `DEPRECATED_MEMBER_USE` hint was split into two hints: +- The `DEPRECATED_MEMBER_USE` hint was split into two hints: - * `DEPRECATED_MEMBER_USE` reports on usage of `@deprecated` members - declared in a different package. - * `DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE` reports on usage of - `@deprecated` members declared in the same package. + - `DEPRECATED_MEMBER_USE` reports on usage of `@deprecated` members declared + in a different package. + - `DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE` reports on usage of `@deprecated` + members declared in the same package. #### Linter Upgraded the linter to `0.1.82` which adds the following improvements: -* Added `provide_deprecation_message`, and - `use_full_hex_values_for_flutter_colors`, `prefer_null_aware_operators`. -* Fixed `prefer_const_declarations` set literal false-positives. -* Updated `prefer_collection_literals` to support set literals. -* Updated `unnecessary_parenthesis` play nicer with cascades. -* Removed deprecated lints from the "all options" sample. -* Stopped registering "default lints". -* Fixed `hash_and_equals` to respect `hashCode` fields. +- Added `provide_deprecation_message`, and + `use_full_hex_values_for_flutter_colors`, `prefer_null_aware_operators`. +- Fixed `prefer_const_declarations` set literal false-positives. +- Updated `prefer_collection_literals` to support set literals. +- Updated `unnecessary_parenthesis` play nicer with cascades. +- Removed deprecated lints from the "all options" sample. +- Stopped registering "default lints". +- Fixed `hash_and_equals` to respect `hashCode` fields. ### Other libraries #### `package:kernel` -* **Breaking change:** The `klass` getter on the `InstanceConstant` class in - the Kernel AST API has been renamed to `classNode` for consistency. +- **Breaking change:** The `klass` getter on the `InstanceConstant` class in the + Kernel AST API has been renamed to `classNode` for consistency. -* **Breaking change:** Updated `Link` implementation to utilize true symbolic - links instead of junctions on Windows. Existing junctions will continue to - work with the new `Link` implementation, but all new links will create - symbolic links. +- **Breaking change:** Updated `Link` implementation to utilize true symbolic + links instead of junctions on Windows. Existing junctions will continue to + work with the new `Link` implementation, but all new links will create + symbolic links. - To create a symbolic link, Dart must be run with administrative privileges - or Developer Mode must be enabled, otherwise a `FileSystemException` will be - raised with errno set to `ERROR_PRIVILEGE_NOT_HELD` (Issue [33966]). + To create a symbolic link, Dart must be run with administrative privileges or + Developer Mode must be enabled, otherwise a `FileSystemException` will be + raised with errno set to `ERROR_PRIVILEGE_NOT_HELD` (Issue [33966]). [33966]: https://github.com/dart-lang/sdk/issues/33966 @@ -2443,11 +2448,11 @@ removed. There are a couple of very minor **breaking changes:** -* In `dart:io`, adding to a closed `IOSink` now throws a `StateError`. +- In `dart:io`, adding to a closed `IOSink` now throws a `StateError`. -* On the Dart VM, a soundness hole when using `dart:mirrors` to reflectively - invoke a method in an incorrect way that violates its static types has - been fixed (Issue [35611][]). +- On the Dart VM, a soundness hole when using `dart:mirrors` to reflectively + invoke a method in an incorrect way that violates its static types has been + fixed (Issue [35611][]). ### Language @@ -2457,31 +2462,31 @@ This release has no language changes. #### `dart:core` -* Made `DateTime.parse()` also recognize `,` as a valid decimal separator - when parsing from a string (Issue [35576][]). +- Made `DateTime.parse()` also recognize `,` as a valid decimal separator when + parsing from a string (Issue [35576][]). [35576]: https://github.com/dart-lang/sdk/issues/35576 #### `dart:html` -* Added methods `Element.removeAttribute`, `Element.removeAttributeNS`, - `Element.hasAttribute` and `Element.hasAttributeNS`. (Issue [35655][]). -* Improved dart2js compilation of `element.attributes.remove(name)` to - generate `element.removeAttribute(name)`, so that there is no performance - reason to migrate to the above methods. -* Fixed a number of `dart:html` bugs: +- Added methods `Element.removeAttribute`, `Element.removeAttributeNS`, + `Element.hasAttribute` and `Element.hasAttributeNS`. (Issue [35655][]). +- Improved dart2js compilation of `element.attributes.remove(name)` to generate + `element.removeAttribute(name)`, so that there is no performance reason to + migrate to the above methods. +- Fixed a number of `dart:html` bugs: - * Fixed HTML API's with callback typedef to correctly convert Dart - functions to JS functions (Issue [35484]). - * HttpStatus constants exposed in `dart:html` (Issue [34318]). - * Expose DomName `ondblclick` and `dblclickEvent` for Angular analyzer. - * Fixed `removeAll` on `classes`; `elements` parameter should be - `Iterable` to match Set's `removeAll` not `Iterable` (Issue - [30278]). - * Fixed a number of methods on DataTransferItem, Entry, FileEntry and - DirectoryEntry which previously returned NativeJavaScriptObject. This - fixes handling drag/drop of files/directories (Issue [35510]). - * Added ability to allow local file access from Chrome browser in ddb. + - Fixed HTML API's with callback typedef to correctly convert Dart functions + to JS functions (Issue [35484]). + - HttpStatus constants exposed in `dart:html` (Issue [34318]). + - Expose DomName `ondblclick` and `dblclickEvent` for Angular analyzer. + - Fixed `removeAll` on `classes`; `elements` parameter should be + `Iterable` to match Set's `removeAll` not `Iterable` (Issue + [30278]). + - Fixed a number of methods on DataTransferItem, Entry, FileEntry and + DirectoryEntry which previously returned NativeJavaScriptObject. This fixes + handling drag/drop of files/directories (Issue [35510]). + - Added ability to allow local file access from Chrome browser in ddb. [35655]: https://github.com/dart-lang/sdk/issues/35655 [30278]: https://github.com/dart-lang/sdk/issues/30278 @@ -2491,8 +2496,8 @@ This release has no language changes. #### `dart:io` -* **Breaking Change:** Adding to a closed `IOSink` now throws a `StateError`. -* Added ability to get and set low level socket options. +- **Breaking Change:** Adding to a closed `IOSink` now throws a `StateError`. +- Added ability to get and set low level socket options. [29554]: https://github.com/dart-lang/sdk/issues/29554 @@ -2528,76 +2533,74 @@ See Issue [35611][] for more details. #### dart2js -* The old "full emitter" back-end is removed and dart2js always uses the "fast - startup" back-end. The generated fast startup code is optimized to load - faster, even though it can be slightly larger. The `--fast-startup` and - `--no-fast-startup` are allowed but ignored. They will be removed in a - future version. +- The old "full emitter" back-end is removed and dart2js always uses the "fast + startup" back-end. The generated fast startup code is optimized to load + faster, even though it can be slightly larger. The `--fast-startup` and + `--no-fast-startup` are allowed but ignored. They will be removed in a future + version. -* We fixed a bug in how deferred constructor calls were incorrectly not marked - as deferred. The old behavior didn't cause breakages, but was imprecise and - pushed more code to the main output unit. +- We fixed a bug in how deferred constructor calls were incorrectly not marked + as deferred. The old behavior didn't cause breakages, but was imprecise and + pushed more code to the main output unit. -* A new deferred split algorithm implementation was added. +- A new deferred split algorithm implementation was added. - This implementation fixes a soundness bug and addresses performance issues - of the previous implementation, because of that it can have a visible impact - on apps. In particular: + This implementation fixes a soundness bug and addresses performance issues of + the previous implementation, because of that it can have a visible impact on + apps. In particular: - * We fixed a performance issue which was introduced when we migrated to - the common front-end. On large apps, the fix can cut 2/3 of the time - spent on this task. + - We fixed a performance issue which was introduced when we migrated to the + common front-end. On large apps, the fix can cut 2/3 of the time spent on + this task. - * We fixed a bug in how inferred types were categorized (Issue [35311][]). - The old behavior was unsound and could produce broken programs. The fix - may cause more code to be pulled into the main output unit. + - We fixed a bug in how inferred types were categorized (Issue [35311][]). The + old behavior was unsound and could produce broken programs. The fix may + cause more code to be pulled into the main output unit. - This shows up frequently when returning deferred values from closures - since the closure's inferred return type is the deferred type. For - example, if you have: + This shows up frequently when returning deferred values from closures since + the closure's inferred return type is the deferred type. For example, if you + have: - ```dart - () async { - await deferred_prefix.loadLibrary(); - return new deferred_prefix.Foo(); - } - ``` + ```dart + () async { + await deferred_prefix.loadLibrary(); + return new deferred_prefix.Foo(); + } + ``` - The closure's return type is `Future`. The old implementation - defers `Foo`, and incorrectly makes the return type `Future`. - This may break in places where the correct type is expected. + The closure's return type is `Future`. The old implementation defers + `Foo`, and incorrectly makes the return type `Future`. This may + break in places where the correct type is expected. - The new implementation will not defer `Foo`, and will place it in the - main output unit. If your intent is to defer it, then you need to ensure - the return type is not inferred to be `Foo`. For example, you can do so - by changing the code to a named closure with a declared type, or by - ensuring that the return expression has the type you want, like: + The new implementation will not defer `Foo`, and will place it in the main + output unit. If your intent is to defer it, then you need to ensure the + return type is not inferred to be `Foo`. For example, you can do so by + changing the code to a named closure with a declared type, or by ensuring + that the return expression has the type you want, like: - ```dart - () async { - await deferred_prefix.loadLibrary(); - return new deferred_prefix.Foo() as dynamic; - } - ``` + ```dart + () async { + await deferred_prefix.loadLibrary(); + return new deferred_prefix.Foo() as dynamic; + } + ``` - Because the new implementation might require you to inspect and fix your - app, we exposed two temporary flags: + Because the new implementation might require you to inspect and fix your + app, we exposed two temporary flags: - * The `--report-invalid-deferred-types` causes dart2js to run both the - old and new algorithms and report any cases where an invalid type was - detected. + - The `--report-invalid-deferred-types` causes dart2js to run both the old and + new algorithms and report any cases where an invalid type was detected. - * The `--new-deferred-split` flag enables this new algorithm. + - The `--new-deferred-split` flag enables this new algorithm. -* The `--categories=*` flag is being replaced. `--categories=all` was only - used for testing and it is no longer supported. `--categories=Server` - continues to work at this time but it is deprecated, please use - `--server-mode` instead. +- The `--categories=*` flag is being replaced. `--categories=all` was only used + for testing and it is no longer supported. `--categories=Server` continues to + work at this time but it is deprecated, please use `--server-mode` instead. -* The `--library-root` flag was replaced by `--libraries-spec`. This flag is - rarely used by developers invoking dart2js directly. It's important for - integrating dart2js with build systems. See `--help` for more details on the - new flag. +- The `--library-root` flag was replaced by `--libraries-spec`. This flag is + rarely used by developers invoking dart2js directly. It's important for + integrating dart2js with build systems. See `--help` for more details on the + new flag. [35311]: https://github.com/dart-lang/sdk/issues/35311 @@ -2605,24 +2608,24 @@ See Issue [35611][] for more details. #### Analyzer -* Support for `declarations-casts` has been removed and the `implicit-casts` - option now has the combined semantics of both options. This means that - users that disable `implicit-casts` might now see errors that were not - previously being reported. +- Support for `declarations-casts` has been removed and the `implicit-casts` + option now has the combined semantics of both options. This means that users + that disable `implicit-casts` might now see errors that were not previously + being reported. -* New hints added: +- New hints added: - * `NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR` and - `NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR_USING_NEW` inform you when a - `@literal` const constructor is called in a non-const context (or with - `new`). - * `INVALID_LITERAL_ANNOTATION` reports when something other than a const - constructor is annotated with `@literal`. - * `SUBTYPE_OF_SEALED_CLASS` reports when any class or mixin subclasses - (extends, implements, mixes in, or constrains to) a `@sealed` class, and - the two are declared in different packages. - * `MIXIN_ON_SEALED_CLASS` reports when a `@sealed` class is used as a - superclass constraint of a mixin. + - `NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR` and + `NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR_USING_NEW` inform you when a + `@literal` const constructor is called in a non-const context (or with + `new`). + - `INVALID_LITERAL_ANNOTATION` reports when something other than a const + constructor is annotated with `@literal`. + - `SUBTYPE_OF_SEALED_CLASS` reports when any class or mixin subclasses + (extends, implements, mixes in, or constrains to) a `@sealed` class, and the + two are declared in different packages. + - `MIXIN_ON_SEALED_CLASS` reports when a `@sealed` class is used as a + superclass constraint of a mixin. #### dartdoc @@ -2631,20 +2634,20 @@ API docs now work in many cases. Upgraded the linter to `0.1.78` which adds the following improvements: -* Added `prefer_final_in_for_each`, `unnecessary_await_in_return`, - `use_function_type_syntax_for_parameters`, - `avoid_returning_null_for_future`, and `avoid_shadowing_type_parameters`. -* Updated `invariant_booleans` status to experimental. -* Fixed `type_annotate_public_apis` false positives on local functions. -* Fixed `avoid_shadowing_type_parameters` to report shadowed type parameters - in generic typedefs. -* Fixed `use_setters_to_change_properties` to not wrongly lint overriding - methods. -* Fixed `cascade_invocations` to not lint awaited targets. -* Fixed `prefer_conditional_assignment` false positives. -* Fixed `join_return_with_assignment` false positives. -* Fixed `cascade_invocations` false positives. -* Deprecated `prefer_bool_in_asserts` as it is redundant in Dart 2. +- Added `prefer_final_in_for_each`, `unnecessary_await_in_return`, + `use_function_type_syntax_for_parameters`, `avoid_returning_null_for_future`, + and `avoid_shadowing_type_parameters`. +- Updated `invariant_booleans` status to experimental. +- Fixed `type_annotate_public_apis` false positives on local functions. +- Fixed `avoid_shadowing_type_parameters` to report shadowed type parameters in + generic typedefs. +- Fixed `use_setters_to_change_properties` to not wrongly lint overriding + methods. +- Fixed `cascade_invocations` to not lint awaited targets. +- Fixed `prefer_conditional_assignment` false positives. +- Fixed `join_return_with_assignment` false positives. +- Fixed `cascade_invocations` false positives. +- Deprecated `prefer_bool_in_asserts` as it is redundant in Dart 2. ## 2.1.0 - 2018-11-15 @@ -2652,288 +2655,286 @@ This is a minor version release. The team's focus was mostly on improving performance and stability after the large changes in Dart 2.0.0. Notable changes: -* We've introduced a dedicated syntax for declaring a mixin. Instead of the - `class` keyword, it uses `mixin`: +- We've introduced a dedicated syntax for declaring a mixin. Instead of the + `class` keyword, it uses `mixin`: - ```dart - mixin SetMixin implements Set { - ... - } - ``` + ```dart + mixin SetMixin implements Set { + ... + } + ``` - The new syntax also enables `super` calls inside mixins. + The new syntax also enables `super` calls inside mixins. -* Integer literals now work in double contexts. When passing a literal number - to a function that expects a `double`, you no longer need an explicit `.0` - at the end of the number. In releases before 2.1, you need code like this - when setting a double like `fontSize`: +- Integer literals now work in double contexts. When passing a literal number to + a function that expects a `double`, you no longer need an explicit `.0` at the + end of the number. In releases before 2.1, you need code like this when + setting a double like `fontSize`: - ```dart - TextStyle(fontSize: 18.0) - ``` + ```dart + TextStyle(fontSize: 18.0) + ``` - Now you can remove the `.0`: + Now you can remove the `.0`: - ```dart - TextStyle(fontSize: 18) - ``` + ```dart + TextStyle(fontSize: 18) + ``` - In releases before 2.1, `fontSize : 18` causes a static error. This was a - common mistake and source of friction. + In releases before 2.1, `fontSize : 18` causes a static error. This was a + common mistake and source of friction. -* **Breaking change:** A number of static errors that should have been - detected and reported were not supported in 2.0.0. These are reported now, - which means existing incorrect code may show new errors. +- **Breaking change:** A number of static errors that should have been detected + and reported were not supported in 2.0.0. These are reported now, which means + existing incorrect code may show new errors. -* `dart:core` now exports `Future` and `Stream`. You no longer need to import - `dart:async` to use those very common types. +- `dart:core` now exports `Future` and `Stream`. You no longer need to import + `dart:async` to use those very common types. ### Language -* Introduced a new syntax for mixin declarations. +- Introduced a new syntax for mixin declarations. - ```dart - mixin SetMixin implements Set { - ... + ```dart + mixin SetMixin implements Set { + ... + } + ``` + + Most classes that are intended to be used as mixins are intended to _only_ be + used as mixins. The library author doesn't want users to be able to construct + or subclass the class. The new syntax makes that intent clear and enforces it + in the type system. It is an error to extend or construct a type declared + using `mixin`. (You can implement it since mixins expose an implicit + interface.) + + Over time, we expect most mixin declarations to use the new syntax. However, + if you have a "mixin" class where users _are_ extending or constructing it, + note that moving it to the new syntax is a breaking API change since it + prevents users from doing that. If you have a type like this that is a mixin + as well as being a concrete class and/or superclass, then the existing syntax + is what you want. + + If you need to use a `super` inside a mixin, the new syntax is required. This + was previously only allowed with the experimental `--supermixins` flag because + it has some complex interactions with the type system. The new syntax + addresses those issues and lets you use `super` calls by declaring the + superclass constraint your mixin requires: + + ```dart + class Superclass { + superclassMethod() { + print("in superclass"); } - ``` + } - Most classes that are intended to be used as mixins are intended to *only* - be used as mixins. The library author doesn't want users to be able to - construct or subclass the class. The new syntax makes that intent clear and - enforces it in the type system. It is an error to extend or construct a type - declared using `mixin`. (You can implement it since mixins expose an - implicit interface.) - - Over time, we expect most mixin declarations to use the new syntax. However, - if you have a "mixin" class where users *are* extending or constructing it, - note that moving it to the new syntax is a breaking API change since it - prevents users from doing that. If you have a type like this that is a - mixin as well as being a concrete class and/or superclass, then the existing - syntax is what you want. - - If you need to use a `super` inside a mixin, the new syntax is required. - This was previously only allowed with the experimental `--supermixins` flag - because it has some complex interactions with the type system. The new - syntax addresses those issues and lets you use `super` calls by declaring - the superclass constraint your mixin requires: - - ```dart - class Superclass { - superclassMethod() { - print("in superclass"); - } + mixin SomeMixin on Superclass { + mixinMethod() { + // This is OK: + super.superclassMethod(); } + } - mixin SomeMixin on Superclass { - mixinMethod() { - // This is OK: - super.superclassMethod(); - } - } + class GoodSub extends Superclass with SomeMixin {} - class GoodSub extends Superclass with SomeMixin {} + class BadSub extends Object with SomeMixin {} + // Error: Since the super() call in mixinMethod() can't find a + // superclassMethod() to call, this is prohibited. + ``` - class BadSub extends Object with SomeMixin {} - // Error: Since the super() call in mixinMethod() can't find a - // superclassMethod() to call, this is prohibited. - ``` + Even if you don't need to use `super` calls, the new mixin syntax is good + because it clearly expresses that you intend the type to be mixed in. - Even if you don't need to use `super` calls, the new mixin syntax is good - because it clearly expresses that you intend the type to be mixed in. +- Allow integer literals to be used in double contexts. An integer literal used + in a place where a double is required is now interpreted as a double value. + The numerical value of the literal needs to be precisely representable as a + double value. -* Allow integer literals to be used in double contexts. An integer literal - used in a place where a double is required is now interpreted as a double - value. The numerical value of the literal needs to be precisely - representable as a double value. - -* Integer literals compiled to JavaScript are now allowed to have any value - that can be exactly represented as a JavaScript `Number`. They were - previously limited to such numbers that were also representable as signed - 64-bit integers. +- Integer literals compiled to JavaScript are now allowed to have any value that + can be exactly represented as a JavaScript `Number`. They were previously + limited to such numbers that were also representable as signed 64-bit + integers. **(Breaking)** A number of static errors that should have been detected and reported were not supported in 2.0.0. These are reported now, which means existing incorrect code may show new errors: -* **Setters with the same name as the enclosing class aren't allowed.** (Issue - [34225][].) It is not allowed to have a class member with the same name as - the enclosing class: +- **Setters with the same name as the enclosing class aren't allowed.** (Issue + [34225][].) It is not allowed to have a class member with the same name as the + enclosing class: - ```dart - class A { - set A(int x) {} - } - ``` + ```dart + class A { + set A(int x) {} + } + ``` - Dart 2.0.0 incorrectly allows this for setters (only). Dart 2.1.0 rejects - it. + Dart 2.0.0 incorrectly allows this for setters (only). Dart 2.1.0 rejects it. - *To fix:* This is unlikely to break anything, since it violates all style - guides anyway. + _To fix:_ This is unlikely to break anything, since it violates all style + guides anyway. -* **Constant constructors cannot redirect to non-constant constructors.** - (Issue [34161][].) It is not allowed to have a constant constructor that - redirects to a non-constant constructor: +- **Constant constructors cannot redirect to non-constant constructors.** (Issue + [34161][].) It is not allowed to have a constant constructor that redirects to + a non-constant constructor: - ```dart - class A { - const A.foo() : this(); // Redirecting to A() - A() {} - } - ``` + ```dart + class A { + const A.foo() : this(); // Redirecting to A() + A() {} + } + ``` - Dart 2.0.0 incorrectly allows this. Dart 2.1.0 rejects it. + Dart 2.0.0 incorrectly allows this. Dart 2.1.0 rejects it. - *To fix:* Make the target of the redirection a properly const constructor. + _To fix:_ Make the target of the redirection a properly const constructor. -* **Abstract methods may not unsoundly override a concrete method.** (Issue - [32014][].) Concrete methods must be valid implementations of their - interfaces: +- **Abstract methods may not unsoundly override a concrete method.** (Issue + [32014][].) Concrete methods must be valid implementations of their + interfaces: - ```dart - class A { - num get thing => 2.0; - } + ```dart + class A { + num get thing => 2.0; + } - abstract class B implements A { - int get thing; - } + abstract class B implements A { + int get thing; + } - class C extends A with B {} - // 'thing' from 'A' is not a valid override of 'thing' from 'B'. + class C extends A with B {} + // 'thing' from 'A' is not a valid override of 'thing' from 'B'. - main() { - print(new C().thing.isEven); // Expects an int but gets a double. - } - ``` + main() { + print(new C().thing.isEven); // Expects an int but gets a double. + } + ``` - Dart 2.0.0 allows unsound overrides like the above in some cases. Dart 2.1.0 - rejects them. + Dart 2.0.0 allows unsound overrides like the above in some cases. Dart 2.1.0 + rejects them. - *To fix:* Relax the type of the invalid override, or tighten the type of the - overridden method. + _To fix:_ Relax the type of the invalid override, or tighten the type of the + overridden method. -* **Classes can't implement FutureOr.** (Issue [33744][].) Dart doesn't allow - classes to implement the FutureOr type: +- **Classes can't implement FutureOr.** (Issue [33744][].) Dart doesn't allow + classes to implement the FutureOr type: - ```dart - class A implements FutureOr {} - ``` + ```dart + class A implements FutureOr {} + ``` - Dart 2.0.0 allows classes to implement FutureOr. Dart 2.1.0 does not. + Dart 2.0.0 allows classes to implement FutureOr. Dart 2.1.0 does not. - *To fix:* Don't do this. + _To fix:_ Don't do this. -* **Type arguments to generic typedefs must satisfy their bounds.** (Issue - [33308][].) If a parameterized typedef specifies a bound, actual arguments - must be checked against it: +- **Type arguments to generic typedefs must satisfy their bounds.** (Issue + [33308][].) If a parameterized typedef specifies a bound, actual arguments + must be checked against it: - ```dart - class A {} + ```dart + class A {} - typedef F = A Function(); + typedef F = A Function(); - F f = null; - ``` + F f = null; + ``` - Dart 2.0.0 allows bounds violations like `F` above. Dart 2.1.0 rejects - them. + Dart 2.0.0 allows bounds violations like `F` above. Dart 2.1.0 rejects + them. - *To fix:* Either remove the bound on the typedef parameter, or pass a valid - argument to the typedef. + _To fix:_ Either remove the bound on the typedef parameter, or pass a valid + argument to the typedef. -* **Constructor invocations must use valid syntax, even with optional `new`.** - (Issue [34403][].) Type arguments to generic named constructors go after the - class name, not the constructor name, even when used without an explicit - `new`: +- **Constructor invocations must use valid syntax, even with optional `new`.** + (Issue [34403][].) Type arguments to generic named constructors go after the + class name, not the constructor name, even when used without an explicit + `new`: - ```dart - class A { - A.foo() {} - } + ```dart + class A { + A.foo() {} + } - main() { - A.foo(); // Incorrect syntax, was accepted in 2.0.0. - A.foo(); // Correct syntax. - } - ``` + main() { + A.foo(); // Incorrect syntax, was accepted in 2.0.0. + A.foo(); // Correct syntax. + } + ``` - Dart 2.0.0 accepts the incorrect syntax when the `new` keyword is left out. - Dart 2.1.0 correctly rejects this code. + Dart 2.0.0 accepts the incorrect syntax when the `new` keyword is left out. + Dart 2.1.0 correctly rejects this code. - *To fix:* Move the type argument to the correct position after the class - name. + _To fix:_ Move the type argument to the correct position after the class name. -* **Instance members should shadow prefixes.** (Issue [34498][].) If the same - name is used as an import prefix and as a class member name, then the class - member name takes precedence in the class scope. +- **Instance members should shadow prefixes.** (Issue [34498][].) If the same + name is used as an import prefix and as a class member name, then the class + member name takes precedence in the class scope. - ```dart - import 'dart:core'; - import 'dart:core' as core; + ```dart + import 'dart:core'; + import 'dart:core' as core; - class A { - core.List get core => null; // "core" refers to field, not prefix. - } - ``` + class A { + core.List get core => null; // "core" refers to field, not prefix. + } + ``` - Dart 2.0.0 incorrectly resolves the use of `core` in `core.List` to the - prefix name. Dart 2.1.0 correctly resolves this to the field name. + Dart 2.0.0 incorrectly resolves the use of `core` in `core.List` to the prefix + name. Dart 2.1.0 correctly resolves this to the field name. - *To fix:* Change the prefix name to something which does not clash with the - instance member. + _To fix:_ Change the prefix name to something which does not clash with the + instance member. -* **Implicit type arguments in extends clauses must satisfy the class - bounds.** (Issue [34532][].) Implicit type arguments for generic classes are - computed if not passed explicitly, but when used in an `extends` clause they - must be checked for validity: +- **Implicit type arguments in extends clauses must satisfy the class bounds.** + (Issue [34532][].) Implicit type arguments for generic classes are computed if + not passed explicitly, but when used in an `extends` clause they must be + checked for validity: - ```dart - class Foo {} + ```dart + class Foo {} - class Bar> {} + class Bar> {} - class Baz extends Bar {} // Should error because Bar completes to Bar - ``` + class Baz extends Bar {} // Should error because Bar completes to Bar + ``` - Dart 2.0.0 accepts the broken code above. Dart 2.1.0 rejects it. + Dart 2.0.0 accepts the broken code above. Dart 2.1.0 rejects it. - *To fix:* Provide explicit type arguments to the superclass that satisfy the - bound for the superclass. + _To fix:_ Provide explicit type arguments to the superclass that satisfy the + bound for the superclass. -* **Mixins must correctly override their superclasses.** (Issue [34235][].) In - some rare cases, combinations of uses of mixins could result in invalid - overrides not being caught: +- **Mixins must correctly override their superclasses.** (Issue [34235][].) In + some rare cases, combinations of uses of mixins could result in invalid + overrides not being caught: - ```dart - class A { - num get thing => 2.0; - } + ```dart + class A { + num get thing => 2.0; + } - class M1 { - int get thing => 2; - } + class M1 { + int get thing => 2; + } - class B = A with M1; + class B = A with M1; - class M2 { - num get thing => 2.0; - } + class M2 { + num get thing => 2.0; + } - class C extends B with M2 {} // 'thing' from 'M2' not a valid override. + class C extends B with M2 {} // 'thing' from 'M2' not a valid override. - main() { - M1 a = new C(); - print(a.thing.isEven); // Expects an int but gets a double. - } - ``` + main() { + M1 a = new C(); + print(a.thing.isEven); // Expects an int but gets a double. + } + ``` - Dart 2.0.0 accepts the above example. Dart 2.1.0 rejects it. + Dart 2.0.0 accepts the above example. Dart 2.1.0 rejects it. - *To fix:* Ensure that overriding methods are correct overrides of their - superclasses, either by relaxing the superclass type, or tightening the - subclass/mixin type. + _To fix:_ Ensure that overriding methods are correct overrides of their + superclasses, either by relaxing the superclass type, or tightening the + subclass/mixin type. [32014]: https://github.com/dart-lang/sdk/issues/32014 [33308]: https://github.com/dart-lang/sdk/issues/33308 @@ -2949,29 +2950,28 @@ existing incorrect code may show new errors: #### `dart:async` -* Fixed a bug where calling `stream.take(0).drain(value)` would not correctly - forward the `value` through the returned `Future`. -* Added a `StreamTransformer.fromBind` constructor. -* Updated `Stream.fromIterable` to send a done event after the error when the - iterator's `moveNext` throws, and handle if the `current` getter throws - (issue [33431][]). +- Fixed a bug where calling `stream.take(0).drain(value)` would not correctly + forward the `value` through the returned `Future`. +- Added a `StreamTransformer.fromBind` constructor. +- Updated `Stream.fromIterable` to send a done event after the error when the + iterator's `moveNext` throws, and handle if the `current` getter throws (issue + [33431][]). [33431]: http://dartbug.com/33431 #### `dart:core` -* Added `HashMap.fromEntries` and `LinkedHashmap.fromEntries` constructors. -* Added `ArgumentError.checkNotNull` utility method. -* Made `Uri` parsing more permissive about `[` and `]` occurring in the path, - query or fragment, and `#` occurring in fragment. -* Exported `Future` and `Stream` from `dart:core`. -* Added operators `&`, `|` and `^` to `bool`. -* Added missing methods to `UnmodifiableMapMixin`. Some maps intended to - be unmodifiable incorrectly allowed new methods added in Dart 2 to - succeed. -* Deprecated the `provisional` annotation and the `Provisional` - annotation class. These should have been removed before releasing Dart 2.0, - and they have no effect. +- Added `HashMap.fromEntries` and `LinkedHashmap.fromEntries` constructors. +- Added `ArgumentError.checkNotNull` utility method. +- Made `Uri` parsing more permissive about `[` and `]` occurring in the path, + query or fragment, and `#` occurring in fragment. +- Exported `Future` and `Stream` from `dart:core`. +- Added operators `&`, `|` and `^` to `bool`. +- Added missing methods to `UnmodifiableMapMixin`. Some maps intended to be + unmodifiable incorrectly allowed new methods added in Dart 2 to succeed. +- Deprecated the `provisional` annotation and the `Provisional` annotation + class. These should have been removed before releasing Dart 2.0, and they have + no effect. #### `dart:html` @@ -2979,228 +2979,227 @@ Fixed Service Workers and any Promise/Future API with a Dictionary parameter. APIs in dart:html (that take a Dictionary) will receive a Dart Map parameter. The Map parameter must be converted to a Dictionary before passing to the -browser's API. Before this change, any Promise/Future API with a -Map/Dictionary parameter never called the Promise and didn't return a Dart -Future - now it does. +browser's API. Before this change, any Promise/Future API with a Map/Dictionary +parameter never called the Promise and didn't return a Dart Future - now it +does. This caused a number of breaks especially in Service Workers (register, etc.). Here is a complete list of the fixed APIs: -* BackgroundFetchManager - * `Future fetch(String id, Object requests, - [Map options])` -* CacheStorage - * `Future match(/*RequestInfo*/ request, [Map options])` -* CanMakePayment - * `Future> matchAll([Map options])` -* CookieStore - * `Future getAll([Map options])` - * `Future set(String name, String value, [Map options])` -* CredentialsContainer - * `Future get([Map options])` - * `Future create([Map options])` -* ImageCapture - * `Future setOptions(Map photoSettings)` -* MediaCapabilities - * `Future decodingInfo(Map configuration)` - * `Future encodingInfo(Map configuration)` -* MediaStreamTrack - * `Future applyConstraints([Map constraints])` -* Navigator - * `Future requestKeyboardLock([List keyCodes])` - * `Future requestMidiAccess([Map options])` - * `Future share([Map data])` -* OffscreenCanvas - * `Future convertToBlob([Map options])` -* PaymentInstruments - * `Future set(String instrumentKey, Map details)` -* Permissions - * `Future query(Map permission)` - * `Future request(Map permissions)` - * `Future revoke(Map permission)` -* PushManager - * `Future permissionState([Map options])` - * `Future subscribe([Map options])` -* RtcPeerConnection - * Changed: +- BackgroundFetchManager + - `Future fetch(String id, Object requests, [Map options])` +- CacheStorage + - `Future match(/*RequestInfo*/ request, [Map options])` +- CanMakePayment + - `Future> matchAll([Map options])` +- CookieStore + - `Future getAll([Map options])` + - `Future set(String name, String value, [Map options])` +- CredentialsContainer + - `Future get([Map options])` + - `Future create([Map options])` +- ImageCapture + - `Future setOptions(Map photoSettings)` +- MediaCapabilities + - `Future decodingInfo(Map configuration)` + - `Future encodingInfo(Map configuration)` +- MediaStreamTrack + - `Future applyConstraints([Map constraints])` +- Navigator + - `Future requestKeyboardLock([List keyCodes])` + - `Future requestMidiAccess([Map options])` + - `Future share([Map data])` +- OffscreenCanvas + - `Future convertToBlob([Map options])` +- PaymentInstruments + - `Future set(String instrumentKey, Map details)` +- Permissions + - `Future query(Map permission)` + - `Future request(Map permissions)` + - `Future revoke(Map permission)` +- PushManager + - `Future permissionState([Map options])` + - `Future subscribe([Map options])` +- RtcPeerConnection - ```dart - Future createAnswer([options_OR_successCallback, - RtcPeerConnectionErrorCallback failureCallback, - Map mediaConstraints]) - ``` + - Changed: - to: + ```dart + Future createAnswer([options_OR_successCallback, + RtcPeerConnectionErrorCallback failureCallback, + Map mediaConstraints]) + ``` - ```dart - Future createAnswer([Map options]) - ``` + to: - * Changed: + ```dart + Future createAnswer([Map options]) + ``` - ```dart - Future createOffer([options_OR_successCallback, - RtcPeerConnectionErrorCallback failureCallback, - Map rtcOfferOptions]) - ``` + - Changed: - to: + ```dart + Future createOffer([options_OR_successCallback, + RtcPeerConnectionErrorCallback failureCallback, + Map rtcOfferOptions]) + ``` - ```dart - Future createOffer([Map options]) - ``` + to: - * Changed: + ```dart + Future createOffer([Map options]) + ``` - ```dart - Future setLocalDescription(Map description, - VoidCallback successCallback, - [RtcPeerConnectionErrorCallback failureCallback]) - ``` + - Changed: - to: + ```dart + Future setLocalDescription(Map description, + VoidCallback successCallback, + [RtcPeerConnectionErrorCallback failureCallback]) + ``` - ```dart - Future setLocalDescription(Map description) - ``` + to: - * Changed: + ```dart + Future setLocalDescription(Map description) + ``` - ```dart - Future setLocalDescription(Map description, - VoidCallback successCallback, - [RtcPeerConnectionErrorCallback failureCallback]) - ``` + - Changed: - to: + ```dart + Future setLocalDescription(Map description, + VoidCallback successCallback, + [RtcPeerConnectionErrorCallback failureCallback]) + ``` - ```dart - Future setRemoteDescription(Map description) - ``` + to: -* ServiceWorkerContainer - * `Future register(String url, [Map options])` -* ServiceWorkerRegistration - * `Future> getNotifications([Map filter])` - * `Future showNotification(String title, [Map options])` -* VRDevice - * `Future requestSession([Map options])` - * `Future supportsSession([Map options])` -* VRSession - * `Future requestFrameOfReference(String type, [Map options])` -* Window - * `Future fetch(/*RequestInfo*/ input, [Map init])` -* WorkerGlobalScope - * `Future fetch(/*RequestInfo*/ input, [Map init])` + ```dart + Future setRemoteDescription(Map description) + ``` + +- ServiceWorkerContainer + - `Future register(String url, [Map options])` +- ServiceWorkerRegistration + - `Future> getNotifications([Map filter])` + - `Future showNotification(String title, [Map options])` +- VRDevice + - `Future requestSession([Map options])` + - `Future supportsSession([Map options])` +- VRSession + - `Future requestFrameOfReference(String type, [Map options])` +- Window + - `Future fetch(/*RequestInfo*/ input, [Map init])` +- WorkerGlobalScope + - `Future fetch(/*RequestInfo*/ input, [Map init])` In addition, exposed Service Worker "self" as a static getter named "instance". -The instance is exposed on four different Service Worker classes and can throw -a InstanceTypeError if the instance isn't of the class expected +The instance is exposed on four different Service Worker classes and can throw a +InstanceTypeError if the instance isn't of the class expected (WorkerGlobalScope.instance will always work and not throw): -* `SharedWorkerGlobalScope.instance` -* `DedicatedWorkerGlobalScope.instance` -* `ServiceWorkerGlobalScope.instance` -* `WorkerGlobalScope.instance` +- `SharedWorkerGlobalScope.instance` +- `DedicatedWorkerGlobalScope.instance` +- `ServiceWorkerGlobalScope.instance` +- `WorkerGlobalScope.instance` #### `dart:io` -* Added new HTTP status codes. +- Added new HTTP status codes. ### Dart for the Web #### dart2js -* **(Breaking)** Duplicate keys in a const map are not allowed and produce a - compile-time error. Dart2js used to report this as a warning before. This - was already an error in dartanalyzer and DDC and will be an error in other - tools in the future as well. +- **(Breaking)** Duplicate keys in a const map are not allowed and produce a + compile-time error. Dart2js used to report this as a warning before. This was + already an error in dartanalyzer and DDC and will be an error in other tools + in the future as well. -* Added `-O` flag to tune optimization levels. For more details run `dart2js - -h -v`. +- Added `-O` flag to tune optimization levels. For more details run + `dart2js -h -v`. - We recommend to enable optimizations using the `-O` flag instead of - individual flags for each optimization. This is because the `-O` flag is - intended to be stable and continue to work in future versions of dart2js, - while individual flags may come and go. + We recommend to enable optimizations using the `-O` flag instead of individual + flags for each optimization. This is because the `-O` flag is intended to be + stable and continue to work in future versions of dart2js, while individual + flags may come and go. - At this time we recommend to test and debug with `-O1` and to deploy with - `-O3`. + At this time we recommend to test and debug with `-O1` and to deploy with + `-O3`. ### Tool Changes #### dartfmt -* Addressed several dartfmt issues when used with the new CFE parser. +- Addressed several dartfmt issues when used with the new CFE parser. #### Linter Bumped the linter to `0.1.70` which includes the following new lints: -* `avoid_returning_null_for_void` -* `sort_pub_dependencies` -* `prefer_mixin` -* `avoid_implementing_value_types` -* `flutter_style_todos` -* `avoid_void_async` -* `prefer_void_to_null` +- `avoid_returning_null_for_void` +- `sort_pub_dependencies` +- `prefer_mixin` +- `avoid_implementing_value_types` +- `flutter_style_todos` +- `avoid_void_async` +- `prefer_void_to_null` and improvements: -* Fixed NPE in `prefer_iterable_whereType`. -* Improved message display for `await_only_futures` -* Performance improvements for `null_closures` -* Mixin support -* Updated `sort_constructors_first` to apply to all members. -* Updated `unnecessary_this` to work on field initializers. -* Updated `unawaited_futures` to ignore assignments within cascades. -* Improved handling of constant expressions with generic type params. -* NPE fix for `invariant_booleans`. -* Improved docs for `unawaited_futures`. -* Updated `unawaited_futures` to check cascades. -* Relaxed `void_checks` (allowing `T Function()` to be assigned to - `void Function()`). -* Fixed false positives in `lines_longer_than_80_chars`. +- Fixed NPE in `prefer_iterable_whereType`. +- Improved message display for `await_only_futures` +- Performance improvements for `null_closures` +- Mixin support +- Updated `sort_constructors_first` to apply to all members. +- Updated `unnecessary_this` to work on field initializers. +- Updated `unawaited_futures` to ignore assignments within cascades. +- Improved handling of constant expressions with generic type params. +- NPE fix for `invariant_booleans`. +- Improved docs for `unawaited_futures`. +- Updated `unawaited_futures` to check cascades. +- Relaxed `void_checks` (allowing `T Function()` to be assigned to + `void Function()`). +- Fixed false positives in `lines_longer_than_80_chars`. #### Pub -* Renamed the `--checked` flag to `pub run` to `--enable-asserts`. -* Pub will no longer delete directories named "packages". -* The `--packages-dir` flag is now ignored. +- Renamed the `--checked` flag to `pub run` to `--enable-asserts`. +- Pub will no longer delete directories named "packages". +- The `--packages-dir` flag is now ignored. ## 2.0.0 - 2018-08-07 This is the first major version release of Dart since 1.0.0, so it contains many significant changes across all areas of the platform. Large changes include: -* **(Breaking)** The unsound optional static type system has been replaced - with a sound static type system using type inference and runtime checks. - This was formerly called "[strong mode][]" and only used by the Dart for web - products. Now it is the one official static type system for the entire - platform and replaces the previous "checked" and "production" modes. +- **(Breaking)** The unsound optional static type system has been replaced with + a sound static type system using type inference and runtime checks. This was + formerly called "[strong mode][]" and only used by the Dart for web products. + Now it is the one official static type system for the entire platform and + replaces the previous "checked" and "production" modes. -* **(Breaking)** Functions marked `async` now run synchronously until the - first `await` statement. Previously, they would return to the event loop - once at the top of the function body before any code runs ([issue 30345][]). +- **(Breaking)** Functions marked `async` now run synchronously until the first + `await` statement. Previously, they would return to the event loop once at the + top of the function body before any code runs ([issue 30345][]). -* **(Breaking)** Constants in the core libraries have been renamed from - `SCREAMING_CAPS` to `lowerCamelCase`. +- **(Breaking)** Constants in the core libraries have been renamed from + `SCREAMING_CAPS` to `lowerCamelCase`. -* **(Breaking)** Many new methods have been added to core library classes. If - you implement the interfaces of these classes, you will need to implement - the new methods. +- **(Breaking)** Many new methods have been added to core library classes. If + you implement the interfaces of these classes, you will need to implement the + new methods. -* **(Breaking)** "dart:isolate" and "dart:mirrors" are no longer supported - when using Dart for the web. They are still supported in the command-line - VM. +- **(Breaking)** "dart:isolate" and "dart:mirrors" are no longer supported when + using Dart for the web. They are still supported in the command-line VM. -* **(Breaking)** Pub's transformer-based build system has been [replaced by a - new build system][transformers]. +- **(Breaking)** Pub's transformer-based build system has been [replaced by a + new build system][transformers]. -* The `new` keyword is optional and can be omitted. Likewise, `const` can be - omitted inside a const context ([issue 30921][]). +- The `new` keyword is optional and can be omitted. Likewise, `const` can be + omitted inside a const context ([issue 30921][]). -* Dartium is no longer maintained or supported. +- Dartium is no longer maintained or supported. [issue 30345]: https://github.com/dart-lang/sdk/issues/30345 [issue 30921]: https://github.com/dart-lang/sdk/issues/30921 @@ -3209,116 +3208,115 @@ significant changes across all areas of the platform. Large changes include: ### Language -* "[Strong mode][]" is now the official type system of the language. +- "[Strong mode][]" is now the official type system of the language. -* The `new` keyword is optional and can be omitted. Likewise, `const` can be - omitted inside a const context. +- The `new` keyword is optional and can be omitted. Likewise, `const` can be + omitted inside a const context. -* A string in a `part of` declaration may now be used to refer to the library - this file is part of. A library part can now declare its library as either: +- A string in a `part of` declaration may now be used to refer to the library + this file is part of. A library part can now declare its library as either: - ```dart - part of name.of.library; - ``` + ```dart + part of name.of.library; + ``` - Or: + Or: - ```dart - part of "uriReferenceOfLibrary.dart"; - ``` + ```dart + part of "uriReferenceOfLibrary.dart"; + ``` - This allows libraries with no library declarations (and therefore no name) - to have parts, and it allows tools to easily find the library of a part - file. The Dart 1.0 syntax is supported but deprecated. + This allows libraries with no library declarations (and therefore no name) to + have parts, and it allows tools to easily find the library of a part file. The + Dart 1.0 syntax is supported but deprecated. -* Functions marked `async` now run synchronously until the first `await` - statement. Previously, they would return to the event loop once at the top - of the function body before any code runs ([issue 30345][]). +- Functions marked `async` now run synchronously until the first `await` + statement. Previously, they would return to the event loop once at the top of + the function body before any code runs ([issue 30345][]). -* The type `void` is now a Top type like `dynamic`, and `Object`. It also now - has new errors for being used where not allowed (such as being assigned to - any non-`void`-typed parameter). Some libraries (importantly, mockito) may - need to be updated to accept void values to keep their APIs working. +- The type `void` is now a Top type like `dynamic`, and `Object`. It also now + has new errors for being used where not allowed (such as being assigned to any + non-`void`-typed parameter). Some libraries (importantly, mockito) may need to + be updated to accept void values to keep their APIs working. -* Future flattening is now done only as specified in the Dart 2.0 spec, rather - than more broadly. This means that the following code has an error on the - assignment to `y`. +- Future flattening is now done only as specified in the Dart 2.0 spec, rather + than more broadly. This means that the following code has an error on the + assignment to `y`. - ```dart - test() { - Future f; - var x = f.then>>((x) => []); - Future> y = x; - } - ``` + ```dart + test() { + Future f; + var x = f.then>>((x) => []); + Future> y = x; + } + ``` -* Invocations of `noSuchMethod()` receive default values for optional args. - The following program used to print "No arguments passed", and now prints - "First argument is 3". +- Invocations of `noSuchMethod()` receive default values for optional args. The + following program used to print "No arguments passed", and now prints "First + argument is 3". - ```dart - abstract class B { - void m([int x = 3]); - } + ```dart + abstract class B { + void m([int x = 3]); + } - class A implements B { - noSuchMethod(Invocation i) { - if (i.positionalArguments.length == 0) { - print("No arguments passed"); - } else { - print("First argument is ${i.positionalArguments[0]}"); - } + class A implements B { + noSuchMethod(Invocation i) { + if (i.positionalArguments.length == 0) { + print("No arguments passed"); + } else { + print("First argument is ${i.positionalArguments[0]}"); } } + } - void main() { - A().m(); - } - ``` + void main() { + A().m(); + } + ``` -* Bounds on generic functions are invariant. The following program now issues - an invalid override error ([issue 29014][sdk#29014]): +- Bounds on generic functions are invariant. The following program now issues an + invalid override error ([issue 29014][sdk#29014]): - ```dart - class A { - void f() {} - } + ```dart + class A { + void f() {} + } - class B extends A { - @override - void f() {} - } - ``` + class B extends A { + @override + void f() {} + } + ``` -* Numerous corner case bugs around return statements in synchronous and - asynchronous functions fixed. Specifically: +- Numerous corner case bugs around return statements in synchronous and + asynchronous functions fixed. Specifically: - * Issues [31887][issue 31887], [32881][issue 32881]. Future flattening - should not be recursive. - * Issues [30638][issue 30638], [32233][issue 32233]. Incorrect downcast - errors with `FutureOr`. - * Issue [32233][issue 32233]. Errors when returning `FutureOr`. - * Issue [33218][issue 33218]. Returns in functions with void related - types. - * Issue [31278][issue 31278]. Incorrect hint on empty returns in async. - functions. + - Issues [31887][issue 31887], [32881][issue 32881]. Future flattening should + not be recursive. + - Issues [30638][issue 30638], [32233][issue 32233]. Incorrect downcast errors + with `FutureOr`. + - Issue [32233][issue 32233]. Errors when returning `FutureOr`. + - Issue [33218][issue 33218]. Returns in functions with void related types. + - Issue [31278][issue 31278]. Incorrect hint on empty returns in async. + functions. -* An empty `return;` in an async function with return type `Future` - does not report an error. +- An empty `return;` in an async function with return type `Future` does + not report an error. -* `return exp;` where `exp` has type `void` in an async function is now an - error unless the return type of the function is `void` or `dynamic`. +- `return exp;` where `exp` has type `void` in an async function is now an error + unless the return type of the function is `void` or `dynamic`. -* Mixed return statements of the form `return;` and `return exp;` are now - allowed when `exp` has type `void`. +- Mixed return statements of the form `return;` and `return exp;` are now + allowed when `exp` has type `void`. -* A compile time error is emitted for any literal which cannot be exactly - represented on the target platform. As a result, dart2js and DDC report - errors if an integer literal cannot be represented exactly in JavaScript - ([issue 33282][]). +- A compile time error is emitted for any literal which cannot be exactly + represented on the target platform. As a result, dart2js and DDC report errors + if an integer literal cannot be represented exactly in JavaScript ([issue + 33282][]). -* New member conflict rules have been implemented. Most cases of conflicting - members with the same name are now static errors ([issue 33235][]). +- New member conflict rules have been implemented. Most cases of conflicting + members with the same name are now static errors ([issue 33235][]). [sdk#29014]: https://github.com/dart-lang/sdk/issues/29014 [issue 30638]: https://github.com/dart-lang/sdk/issues/30638 @@ -3333,144 +3331,138 @@ significant changes across all areas of the platform. Large changes include: ### Core libraries -* Replaced `UPPER_CASE` constant names with `lowerCamelCase`. For example, - `HTML_ESCAPE` is now `htmlEscape`. +- Replaced `UPPER_CASE` constant names with `lowerCamelCase`. For example, + `HTML_ESCAPE` is now `htmlEscape`. -* The Web libraries were re-generated using Chrome 63 WebIDLs - ([details][idl]). +- The Web libraries were re-generated using Chrome 63 WebIDLs ([details][idl]). [idl]: https://github.com/dart-lang/sdk/wiki/Chrome-63-Dart-Web-Libraries #### `dart:async` -* `Stream`: - * Added `cast` and `castFrom`. - * Changed `firstWhere`, `lastWhere`, and `singleWhere` to return - `Future` and added an optional `T orElse()` callback. -* `StreamTransformer`: added `cast` and `castFrom`. -* `StreamTransformerBase`: new class. -* `Timer`: added `tick` property. -* `Zone` - * changed to be strong-mode clean. This required some breaking API - changes. See https://goo.gl/y9mW2x for more information. - * Added `bindBinaryCallbackGuarded`, `bindCallbackGuarded`, and - `bindUnaryCallbackGuarded`. - * Renamed `Zone.ROOT` to `Zone.root`. -* Removed the deprecated `defaultValue` parameter on `Stream.firstWhere` and - `Stream.lastWhere`. -* Changed an internal lazily-allocated reusable "null future" to always belong - to the root zone. This avoids race conditions where the first access to the - future determined which zone it would belong to. The zone is only used for - *scheduling* the callback of listeners, the listeners themselves will run in - the correct zone in any case. Issue [#32556](http://dartbug.com/32556). +- `Stream`: + - Added `cast` and `castFrom`. + - Changed `firstWhere`, `lastWhere`, and `singleWhere` to return `Future` + and added an optional `T orElse()` callback. +- `StreamTransformer`: added `cast` and `castFrom`. +- `StreamTransformerBase`: new class. +- `Timer`: added `tick` property. +- `Zone` + - changed to be strong-mode clean. This required some breaking API changes. + See https://goo.gl/y9mW2x for more information. + - Added `bindBinaryCallbackGuarded`, `bindCallbackGuarded`, and + `bindUnaryCallbackGuarded`. + - Renamed `Zone.ROOT` to `Zone.root`. +- Removed the deprecated `defaultValue` parameter on `Stream.firstWhere` and + `Stream.lastWhere`. +- Changed an internal lazily-allocated reusable "null future" to always belong + to the root zone. This avoids race conditions where the first access to the + future determined which zone it would belong to. The zone is only used for + _scheduling_ the callback of listeners, the listeners themselves will run in + the correct zone in any case. Issue [#32556](http://dartbug.com/32556). #### `dart:cli` -* *New* "provisional" library for CLI-specific features. -* `waitFor`: function that suspends a stack to wait for a `Future` to - complete. +- _New_ "provisional" library for CLI-specific features. +- `waitFor`: function that suspends a stack to wait for a `Future` to complete. #### `dart:collection` -* `MapBase`: added `mapToString`. -* `LinkedHashMap` no longer implements `HashMap` -* `LinkedHashSet` no longer implements `HashSet`. -* Added `of` constructor to `Queue`, `ListQueue`, `DoubleLinkedQueue`, - `HashSet`, `LinkedHashSet`, `SplayTreeSet`, `Map`, `HashMap`, - `LinkedHashMap`, `SplayTreeMap`. -* Removed `Maps` class. Extend `MapBase` or mix in `MapMixin` instead to - provide map method implementations for a class. -* Removed experimental `Document` method `getCSSCanvasContext` and property - `supportsCssCanvasContext`. -* Removed obsolete `Element` property `xtag` no longer supported in browsers. -* Exposed `ServiceWorker` class. -* Added constructor to `MessageChannel` and `MessagePort` `addEventListener` - automatically calls `start` method to receive queued messages. +- `MapBase`: added `mapToString`. +- `LinkedHashMap` no longer implements `HashMap` +- `LinkedHashSet` no longer implements `HashSet`. +- Added `of` constructor to `Queue`, `ListQueue`, `DoubleLinkedQueue`, + `HashSet`, `LinkedHashSet`, `SplayTreeSet`, `Map`, `HashMap`, `LinkedHashMap`, + `SplayTreeMap`. +- Removed `Maps` class. Extend `MapBase` or mix in `MapMixin` instead to provide + map method implementations for a class. +- Removed experimental `Document` method `getCSSCanvasContext` and property + `supportsCssCanvasContext`. +- Removed obsolete `Element` property `xtag` no longer supported in browsers. +- Exposed `ServiceWorker` class. +- Added constructor to `MessageChannel` and `MessagePort` `addEventListener` + automatically calls `start` method to receive queued messages. #### `dart:convert` -* `Base64Codec.decode` return type is now `Uint8List`. -* `JsonUnsupportedObjectError`: added `partialResult` property -* `LineSplitter` now implements `StreamTransformer` instead of - `Converter`. It retains `Converter` methods `convert` and - `startChunkedConversion`. -* `Utf8Decoder` when compiled with dart2js uses the browser's `TextDecoder` in - some common cases for faster decoding. -* Renamed `ASCII`, `BASE64`, `BASE64URI`, `JSON`, `LATIN1` and `UTF8` to - `ascii`, `base64`, `base64Uri`, `json`, `latin1` and `utf8`. -* Renamed the `HtmlEscapeMode` constants `UNKNOWN`, `ATTRIBUTE`, - `SQ_ATTRIBUTE` and `ELEMENT` to `unknown`, `attribute`, `sqAttribute` and - `elements`. -* Added `jsonEncode`, `jsonDecode`, `base64Encode`, `base64UrlEncode` and - `base64Decode` top-level functions. -* Changed return type of `encode` on `AsciiCodec` and `Latin1Codec`, and - `convert` on `AsciiEncoder`, `Latin1Encoder`, to `Uint8List`. -* Allow `utf8.decoder.fuse(json.decoder)` to ignore leading Unicode BOM. +- `Base64Codec.decode` return type is now `Uint8List`. +- `JsonUnsupportedObjectError`: added `partialResult` property +- `LineSplitter` now implements `StreamTransformer` instead of + `Converter`. It retains `Converter` methods `convert` and + `startChunkedConversion`. +- `Utf8Decoder` when compiled with dart2js uses the browser's `TextDecoder` in + some common cases for faster decoding. +- Renamed `ASCII`, `BASE64`, `BASE64URI`, `JSON`, `LATIN1` and `UTF8` to + `ascii`, `base64`, `base64Uri`, `json`, `latin1` and `utf8`. +- Renamed the `HtmlEscapeMode` constants `UNKNOWN`, `ATTRIBUTE`, `SQ_ATTRIBUTE` + and `ELEMENT` to `unknown`, `attribute`, `sqAttribute` and `elements`. +- Added `jsonEncode`, `jsonDecode`, `base64Encode`, `base64UrlEncode` and + `base64Decode` top-level functions. +- Changed return type of `encode` on `AsciiCodec` and `Latin1Codec`, and + `convert` on `AsciiEncoder`, `Latin1Encoder`, to `Uint8List`. +- Allow `utf8.decoder.fuse(json.decoder)` to ignore leading Unicode BOM. #### `dart:core` -* `BigInt` class added to support integers greater than 64-bits. -* Deprecated the `proxy` annotation. -* Added `Provisional` class and `provisional` field. -* Added `pragma` annotation. -* `RegExp` added static `escape` function. -* The `Uri` class now correctly handles paths while running on Node.js on - Windows. -* Core collection changes: - * `Iterable` added members `cast`, `castFrom`, `followedBy` and - `whereType`. - * `Iterable.singleWhere` added `orElse` parameter. - * `List` added `+` operator, `first` and `last` setters, and `indexWhere` - and `lastIndexWhere` methods, and static `copyRange` and `writeIterable` - methods. - * `Map` added `fromEntries` constructor. - * `Map` added `addEntries`, `cast`, `entries`, `map`, `removeWhere`, - `update` and `updateAll` members. - * `MapEntry`: new class used by `Map.entries`. - * *Note*: if a class extends `IterableBase`, `ListBase`, `SetBase` or - `MapBase` (or uses the corresponding mixins) from `dart:collection`, the - new members are implemented automatically. - * Added `of` constructor to `List`, `Set`, `Map`. -* Renamed `double.INFINITY`, `double.NEGATIVE_INFINITY`, `double.NAN`, - `double.MAX_FINITE` and `double.MIN_POSITIVE` to `double.infinity`, - `double.negativeInfinity`, `double.nan`, `double.maxFinite` and - `double.minPositive`. -* Renamed the following constants in `DateTime` to lower case: `MONDAY` - through `SUNDAY`, `DAYS_PER_WEEK` (as `daysPerWeek`), `JANUARY` through - `DECEMBER` and `MONTHS_PER_YEAR` (as `monthsPerYear`). -* Renamed the following constants in `Duration` to lower case: - `MICROSECONDS_PER_MILLISECOND` to `microsecondsPerMillisecond`, - `MILLISECONDS_PER_SECOND` to `millisecondsPerSecond`, `SECONDS_PER_MINUTE` - to `secondsPerMinute`, `MINUTES_PER_HOUR` to `minutesPerHour`, - `HOURS_PER_DAY` to `hoursPerDay`, `MICROSECONDS_PER_SECOND` to - `microsecondsPerSecond`, `MICROSECONDS_PER_MINUTE` to - `microsecondsPerMinute`, `MICROSECONDS_PER_HOUR` to `microsecondsPerHour`, - `MICROSECONDS_PER_DAY` to `microsecondsPerDay`, `MILLISECONDS_PER_MINUTE` to - `millisecondsPerMinute`, `MILLISECONDS_PER_HOUR` to `millisecondsPerHour`, - `MILLISECONDS_PER_DAY` to `millisecondsPerDay`, `SECONDS_PER_HOUR` to - `secondsPerHour`, `SECONDS_PER_DAY` to `secondsPerDay`, `MINUTES_PER_DAY` to - `minutesPerDay`, and `ZERO` to `zero`. -* Added `typeArguments` to `Invocation` class. -* Added constructors to invocation class that allows creation of `Invocation` - objects directly, without going through `noSuchMethod`. -* Added `unaryMinus` and `empty` constant symbols on the `Symbol` class. -* Changed return type of `UriData.dataAsBytes` to `Uint8List`. -* Added `tryParse` static method to `int`, `double`, `num`, `BigInt`, `Uri` - and `DateTime`. -* Deprecated `onError` parameter on `int.parse`, `double.parse` and - `num.parse`. -* Deprecated the `NoSuchMethodError` constructor. -* `int.parse` on the VM no longer accepts unsigned hexadecimal numbers greater - than or equal to `2**63` when not prefixed by `0x`. (SDK issue - [32858](https://github.com/dart-lang/sdk/issues/32858)) +- `BigInt` class added to support integers greater than 64-bits. +- Deprecated the `proxy` annotation. +- Added `Provisional` class and `provisional` field. +- Added `pragma` annotation. +- `RegExp` added static `escape` function. +- The `Uri` class now correctly handles paths while running on Node.js on + Windows. +- Core collection changes: + - `Iterable` added members `cast`, `castFrom`, `followedBy` and `whereType`. + - `Iterable.singleWhere` added `orElse` parameter. + - `List` added `+` operator, `first` and `last` setters, and `indexWhere` and + `lastIndexWhere` methods, and static `copyRange` and `writeIterable` + methods. + - `Map` added `fromEntries` constructor. + - `Map` added `addEntries`, `cast`, `entries`, `map`, `removeWhere`, `update` + and `updateAll` members. + - `MapEntry`: new class used by `Map.entries`. + - _Note_: if a class extends `IterableBase`, `ListBase`, `SetBase` or + `MapBase` (or uses the corresponding mixins) from `dart:collection`, the new + members are implemented automatically. + - Added `of` constructor to `List`, `Set`, `Map`. +- Renamed `double.INFINITY`, `double.NEGATIVE_INFINITY`, `double.NAN`, + `double.MAX_FINITE` and `double.MIN_POSITIVE` to `double.infinity`, + `double.negativeInfinity`, `double.nan`, `double.maxFinite` and + `double.minPositive`. +- Renamed the following constants in `DateTime` to lower case: `MONDAY` through + `SUNDAY`, `DAYS_PER_WEEK` (as `daysPerWeek`), `JANUARY` through `DECEMBER` and + `MONTHS_PER_YEAR` (as `monthsPerYear`). +- Renamed the following constants in `Duration` to lower case: + `MICROSECONDS_PER_MILLISECOND` to `microsecondsPerMillisecond`, + `MILLISECONDS_PER_SECOND` to `millisecondsPerSecond`, `SECONDS_PER_MINUTE` to + `secondsPerMinute`, `MINUTES_PER_HOUR` to `minutesPerHour`, `HOURS_PER_DAY` to + `hoursPerDay`, `MICROSECONDS_PER_SECOND` to `microsecondsPerSecond`, + `MICROSECONDS_PER_MINUTE` to `microsecondsPerMinute`, `MICROSECONDS_PER_HOUR` + to `microsecondsPerHour`, `MICROSECONDS_PER_DAY` to `microsecondsPerDay`, + `MILLISECONDS_PER_MINUTE` to `millisecondsPerMinute`, `MILLISECONDS_PER_HOUR` + to `millisecondsPerHour`, `MILLISECONDS_PER_DAY` to `millisecondsPerDay`, + `SECONDS_PER_HOUR` to `secondsPerHour`, `SECONDS_PER_DAY` to `secondsPerDay`, + `MINUTES_PER_DAY` to `minutesPerDay`, and `ZERO` to `zero`. +- Added `typeArguments` to `Invocation` class. +- Added constructors to invocation class that allows creation of `Invocation` + objects directly, without going through `noSuchMethod`. +- Added `unaryMinus` and `empty` constant symbols on the `Symbol` class. +- Changed return type of `UriData.dataAsBytes` to `Uint8List`. +- Added `tryParse` static method to `int`, `double`, `num`, `BigInt`, `Uri` and + `DateTime`. +- Deprecated `onError` parameter on `int.parse`, `double.parse` and `num.parse`. +- Deprecated the `NoSuchMethodError` constructor. +- `int.parse` on the VM no longer accepts unsigned hexadecimal numbers greater + than or equal to `2**63` when not prefixed by `0x`. (SDK issue + [32858](https://github.com/dart-lang/sdk/issues/32858)) #### `dart:developer` -* `Flow` class added. -* `Timeline.startSync` and `Timeline.timeSync` now accepts an optional - parameter `flow` of type `Flow`. The `flow` parameter is used to generate - flow timeline events that are enclosed by the slice described by - `Timeline.{start,finish}Sync` and `Timeline.timeSync`. +- `Flow` class added. +- `Timeline.startSync` and `Timeline.timeSync` now accepts an optional parameter + `flow` of type `Flow`. The `flow` parameter is used to generate flow timeline + events that are enclosed by the slice described by + `Timeline.{start,finish}Sync` and `Timeline.timeSync`.