2022-12-09 16:02:02 +00:00
## 3.0.0
2023-02-08 17:44:17 +00:00
### Language
- **Breaking Change** [#50902][]: Report a compile-time error for a `continue` statement
having an invalid target.
As per 18.15 of the language spec, it is a compile-time error for a `continue`
label to have a target which is not a loop (`for`, `do` and `while` statements)
or a `switch` member.
Breakage is mitigated by changing the code to have the `continue` label properly
target a valid labeled statement.
[#50902]: https://github.com/dart-lang/sdk/issues/50902
2022-12-09 16:02:02 +00:00
### Libraries
2022-12-12 09:48:05 +00:00
#### `dart:core`
- **Breaking change** [#49529][]:
2022-12-19 09:51:38 +00:00
- Removed the deprecated `List` constructor, as it wasn't null safe.
Use list literals (e.g. `[]` for an empty list or `<int>[]` for an empty
typed list) or [`List.filled`][].
2022-12-12 11:51:35 +00:00
- Removed the deprecated `onError` argument on [`int.parse`][], [`double.parse`][],
and [`num.parse`][]. Use the [`tryParse`][] method instead.
2022-12-12 11:46:58 +00:00
- Removed the deprecated [`proxy`][] and [`Provisional`][] annotations.
The original `proxy` annotation has no effect in Dart 2,
and the `Provisional` type and [`provisional`][] constant
were only used internally during the Dart 2.0 development process.
- Removed the deprecated [`Deprecated.expires`][] getter.
Use [`Deprecated.message`][] instead.
2022-12-15 13:38:47 +00:00
- Removed the deprecated [`CastError`][] error.
Use [`TypeError`][] instead.
- Removed the deprecated [`FallThroughError`][] error. The kind of
fall-through previously throwing this error was made a compile-time
error in Dart 2.0.
2022-12-19 08:29:29 +00:00
- Removed the deprecated [`NullThrownError`][] error. This error is never
thrown from null safe code.
2022-12-15 13:38:47 +00:00
- Removed the deprecated [`AbstractClassInstantiationError`][] error. It was made
a compile-time error to call the constructor of an abstract class in Dart 2.0.
2022-12-19 08:29:29 +00:00
- Removed the deprecated [`CyclicInitializationError`]. Cyclic dependencies are
no longer detected at runtime in null safe code. Such code will fail in other
ways instead, possibly with a StackOverflowError.
2022-12-19 09:51:38 +00:00
- Removed the deprecated [`NoSuchMethodError`][] default constructor.
Use the [`NoSuchMethodError.withInvocation`][] named constructor instead.
2023-01-02 16:14:08 +00:00
- Removed the deprecated [`BidirectionalIterator`][] class.
Existing bidirectional iterators can still work, they just don't have
a shared supertype locking them to a specific name for moving backwards.
2022-12-12 09:48:05 +00:00
[#49529]: https://github.com/dart-lang/sdk/issues/49529
2022-12-19 09:51:38 +00:00
[`List.filled`]: https://api.dart.dev/stable/2.18.6/dart-core/List/List.filled.html
2022-12-12 11:51:35 +00:00
[`int.parse`]: https://api.dart.dev/stable/2.18.4/dart-core/int/parse.html
[`double.parse`]: https://api.dart.dev/stable/2.18.4/dart-core/double/parse.html
[`num.parse`]: https://api.dart.dev/stable/2.18.4/dart-core/num/parse.html
[`tryParse`]: https://api.dart.dev/stable/2.18.4/dart-core/num/tryParse.html
2022-12-12 11:46:58 +00:00
[`Deprecated.expires`]: https://api.dart.dev/stable/2.18.4/dart-core/Deprecated/expires.html
[`Deprecated.message`]: https://api.dart.dev/stable/2.18.4/dart-core/Deprecated/message.html
2022-12-19 09:51:38 +00:00
[`AbstractClassInstantiationError`]: https://api.dart.dev/stable/2.17.4/dart-core/AbstractClassInstantiationError-class.html
[`CastError`]: https://api.dart.dev/stable/2.17.4/dart-core/CastError-class.html
[`FallThroughError`]: https://api.dart.dev/stable/2.17.4/dart-core/FallThroughError-class.html
2022-12-12 09:48:05 +00:00
[`NoSuchMethodError`]: https://api.dart.dev/stable/2.18.4/dart-core/NoSuchMethodError/NoSuchMethodError.html
[`NoSuchMethodError.withInvocation`]: https://api.dart.dev/stable/2.18.4/dart-core/NoSuchMethodError/NoSuchMethodError.withInvocation.html
2022-12-19 09:51:38 +00:00
[`CyclicInitializationError`]: https://api.dart.dev/dev/2.19.0-430.0.dev/dart-core/CyclicInitializationError-class.html
2022-12-12 11:46:58 +00:00
[`Provisional`]: https://api.dart.dev/stable/2.18.4/dart-core/Provisional-class.html
[`provisional`]: https://api.dart.dev/stable/2.18.4/dart-core/provisional-constant.html
[`proxy`]: https://api.dart.dev/stable/2.18.4/dart-core/proxy-constant.html
2022-12-15 13:38:47 +00:00
[`CastError`]: https://api.dart.dev/stable/2.18.3/dart-core/CastError-class.html
[`TypeError`]: https://api.dart.dev/stable/2.18.3/dart-core/TypeError-class.html
[`FallThroughError`]: https://api.dart.dev/dev/2.19.0-374.0.dev/dart-core/FallThroughError-class.html
2022-12-19 08:29:29 +00:00
[`NullThrownError`]: https://api.dart.dev/dev/2.19.0-430.0.dev/dart-core/NullThrownError-class.html
2022-12-15 13:38:47 +00:00
[`AbstractClassInstantiationError`]: https://api.dart.dev/stable/2.18.3/dart-core/AbstractClassInstantiationError-class.html
2022-12-19 08:29:29 +00:00
[`CyclicInitializationError`]: https://api.dart.dev/dev/2.19.0-430.0.dev/dart-core/CyclicInitializationError-class.html
2023-01-02 16:14:08 +00:00
[`BidirectionalIterator`]: https://api.dart.dev/dev/2.19.0-430.0.dev/dart-core/BidirectionalIterator-class.html
2022-12-12 09:48:05 +00:00
2022-12-12 09:35:29 +00:00
#### `dart:async`
- **Breaking change** [#49529][]:
- Removed the deprecated [`DeferredLibrary`][] class.
Use the [`deferred as`][] import syntax instead.
[#49529]: https://github.com/dart-lang/sdk/issues/49529
[`DeferredLibrary`]: https://api.dart.dev/stable/2.18.4/dart-async/DeferredLibrary-class.html
[`deferred as`]: https://dart.dev/guides/language/language-tour#deferred-loading
2023-01-09 12:14:33 +00:00
#### `dart:collection`
- Deprecated the `HasNextIterator` class ([#50883][]).
[#50883]: https://github.com/dart-lang/sdk/issues/50883
2022-12-12 10:49:58 +00:00
#### `dart:developer`
- **Breaking change** [#49529][]:
2023-01-02 16:14:08 +00:00
- Removed the deprecated [`MAX_USER_TAGS`][] constant.
2022-12-12 10:49:58 +00:00
Use [`maxUserTags`][] instead.
2022-12-15 15:05:17 +00:00
- Callbacks passed to `registerExtension` will be run in the zone from which
they are registered.
2022-12-12 10:49:58 +00:00
2023-01-06 15:56:58 +00:00
- **Breaking change** [#50231][]:
- Removed the deprecated [`Metrics`][], [`Metric`][], [`Counter`][],
and [`Gauge`][] classes as they have been broken since Dart 2.0.
2022-12-12 10:49:58 +00:00
[#49529]: https://github.com/dart-lang/sdk/issues/49529
2023-01-06 15:56:58 +00:00
[#50231]: https://github.com/dart-lang/sdk/issues/50231
2022-12-12 10:49:58 +00:00
[`MAX_USER_TAGS`]: https://api.dart.dev/stable/dart-developer/UserTag/MAX_USER_TAGS-constant.html
[`maxUserTags`]: https://api.dart.dev/beta/2.19.0-255.2.beta/dart-developer/UserTag/maxUserTags-constant.html
2023-01-06 15:56:58 +00:00
[`Metrics`]: https://api.dart.dev/stable/2.18.2/dart-developer/Metrics-class.html
[`Metric`]: https://api.dart.dev/stable/2.18.2/dart-developer/Metric-class.html
[`Counter`]: https://api.dart.dev/stable/2.18.2/dart-developer/Counter-class.html
[`Gauge`]: https://api.dart.dev/stable/2.18.2/dart-developer/Gauge-class.html
2022-12-12 10:49:58 +00:00
2022-12-19 09:51:38 +00:00
#### `dart:html`
- **Breaking change**: As previously announced, the deprecated `registerElement`
and `registerElement2` methods in `Document` and `HtmlDocument` have been
removed. See [#49536 ](https://github.com/dart-lang/sdk/issues/49536 ) for
details.
2022-12-21 00:23:02 +00:00
#### `dart:io`
- Deprecated `NetworkInterface.listSupported` . Has always returned true since
Dart 2.3.
2023-02-02 19:22:49 +00:00
- Finalize `httpEnableTimelineLogging` parameter name transition from `enable`
to `enabled` . See [#43638][].
- **Breaking change** [#51035][]:
- Update `NetworkProfiling` to accommodate new `String` ids
that are introduced in vm_service:11.0.0
2022-12-21 00:23:02 +00:00
2022-12-19 09:51:38 +00:00
#### `dart:js_util`
- Added several helper functions to access more JavaScript operator, like
`delete` and the `typeof` functionality.
2022-12-13 21:32:24 +00:00
### Tools
2023-01-03 20:14:12 +00:00
#### Web Dev Compiler (DDC)
- Removed deprecated command line flags `-k` , `--kernel` , and `--dart-sdk` .
2022-12-15 22:51:28 +00:00
#### Linter
2023-02-16 23:19:10 +00:00
Updates the Linter to `1.34.0-dev` , which includes changes that
2023-02-07 20:56:35 +00:00
- add new lint: `unnecessary_breaks` .
- remove support for:
- `enable_null_safety`
- `invariant_booleans`
- `prefer_bool_in_asserts`
- `prefer_equal_for_default_values`
- `super_goes_last`
- fix `unnecessary_parenthesis` false-positives with null-aware expressions.
- fix `void_checks` to allow assignments of `Future<dynamic>?` to parameters
typed `FutureOr<void>?` .
- fix `use_build_context_synchronously` in if conditions.
2023-02-16 23:19:10 +00:00
- fix a false positive for `avoid_private_typedef_functions` with generalized
type aliases.
2023-02-07 20:56:35 +00:00
- update `unnecessary_parenthesis` to detect some doubled parens.
- update `void_checks` to allow returning `Never` as void.
- update `no_adjacent_strings_in_list` to support set literals and for- and
if-elements.
2022-12-15 22:51:28 +00:00
- update `avoid_types_as_parameter_names` to handle type variables.
- update `avoid_positional_boolean_parameters` to handle typedefs.
2023-02-16 23:19:10 +00:00
- update `avoid_redundant_argument_values` to check parameters of redirecting
constructors.
2022-12-15 22:51:28 +00:00
- improve performance for `prefer_const_literals_to_create_immutables` .
- update `use_build_context_synchronously` to check context properties.
2023-02-16 23:19:10 +00:00
- improve `unnecessary_parenthesis` support for property accesses and method
invocations.
- add new lint: `invalid_case_patterns` .
- update `unnecessary_parenthesis` to allow parentheses in more null-aware
cascade contexts.
- update `unreachable_from_main` to track static elements.
2022-12-15 22:51:28 +00:00
2023-01-09 18:06:16 +00:00
#### Migration tool removal
The null safety migration tool (`dart migrate`) has been removed. If you still
have code which needs to be migrated to null safety, please run `dart migrate`
using Dart version 2.19, before upgrading to Dart version 3.0.
2023-02-07 15:01:53 +00:00
#### Pub
- To preserve compatibility with null-safe code pre Dart 3 Pub will interpret a
language constraint indicating a language version of `2.12` or higher and an
upper bound of `<3.0.0` as `<4.0.0` .
For example `>=2.19.2 <3.0.0` will be interpreted as `>=2.19.2 <4.0.0` .
- `dart pub publish` will no longer warn about `dependency_overrides` . Dependency
overrides only take effect in the root package of a resolution.
- `dart pub token add` now verifies that the given token is valid for including
in a header according to [RFC 6750 section
2.1](https://www.rfc-editor.org/rfc/rfc6750#section-2.1). This means they must
contain only the characters: `^[a-zA-Z0-9._~+/=-]+$` . Before a failure would
happen when attempting to send the authorization header.
2023-02-08 14:33:50 +00:00
## 2.19.2 - 2023-02-08
This is a patch release that:
- Fixes a VM crash when mixing the use of double and float calculations in
debug/jit configuration. (issue [#50622][]).
- Fixes the compiler crashing when attempting to inline a method with lots of
optional parameters with distinct default values. (issue [#119220][]).
- Fixes the `part_of_different_library` error encountered when using `PackageBuildWorkspace` . (issue [#51087][]).
[#50622]: https://github.com/dart-lang/sdk/issues/50622
[#119220]: https://github.com/flutter/flutter/issues/119220
[#51087]: https://github.com/dart-lang/sdk/issues/51087
## 2.19.1 - 2023-02-01
This is a patch release that:
- Fixes `pub get` behaviour: In Dart 2.19.0 a `dart pub get` with a
`pubspec.lock` created by a 2.18 SDK will unlock all constraints, effectively
like a `pub upgrade` (issue [#51166][]).
- Stops rewriting SDK constraints: In Dart 3, a SDK constraint like
`>=2.12.0 <3.0.0` gets interpreted by the pub client as `>=2.12.0 <4.0.0` to
allow for backwards compatibility (issue [#51101][]).
This change was intended for Dart 3.0.0 and later, but was landed already in
2.19.0. It is now being removed in 2.19.1, as it can give confusing messages
such as:
> Because library requires SDK version >=2.19.2 <4.0.0, version solving failed.
This reinterpretation no longer happens in Dart 2.19.1.
- Fixes a VM crash caused by incorrect sharing of RegExp between isolates
(issue [#51130][]).
[#51166]: https://github.com/dart-lang/sdk/issues/51166
[#51101]: https://github.com/dart-lang/sdk/issues/51101
[#51130]: https://github.com/dart-lang/sdk/issues/51130
## 2.19.0 - 2023-01-24
2022-06-13 15:30:57 +00:00
### Language
2022-08-22 16:50:19 +00:00
- **Breaking change** [#49635][]: Flag additional code as unreachable due to
2022-12-07 20:39:10 +00:00
types `Null` and `Never` . Several unusual constructs that lead to unreachable
2022-08-22 16:50:19 +00:00
code are now recognized by flow analysis:
- Control flow after an expression of the form `e ?? other` or `e ??= other` ,
where `e` has static type `Null` and `other` has static type `Never` , is
considered unreachable.
- Control flow predicated on an expression of the form `e is Never` evaluating
to `true` is considered unreachable.
- Control flow predicated on an expression of the form `e is! Never`
evaluating to `false` is considered unreachable.
- Control flow on the RHS of a null-aware access such as `e?.property...` ,
`e?.property = ...` or `e?.method(...)` , where `e` has static type `Null` ,
is considered unreachable (Note: this can arise in the presence of extension
methods).
Previously, these behaviors only took effect if `e` was a reference to a local
variable.
2022-09-08 16:05:05 +00:00
Additionally, a type test of the form `v is Never` (where `v` is a local
variable) no longer promotes `v` to type `Never` .
2022-08-22 16:50:19 +00:00
[#49635]: https://github.com/dart-lang/sdk/issues/49635
2022-09-27 21:20:35 +00:00
- **Breaking Change** [#49687][]: Don't delegate inaccessible private names to
`noSuchMethod` . If a concrete class implements an interface containing a
member with a name that's private to different library, and does not inherit
an implementation of that interface member, a invocation of that member will
2022-12-07 20:39:10 +00:00
result in an exception getting thrown. Previously, such attempts would result
2022-09-27 21:20:35 +00:00
in the call being diverted to the `noSuchMethod` method.
This change closes a loophole in Dart's privacy system, where another library
can provide a different implementation of a supposedly private member using
`noSuchMethod` , and paves the way for a future implementation of promotion for
private final fields (see [#2020][]).
[#49687]: https://github.com/dart-lang/sdk/issues/49687
[#2020]: https://github.com/dart-lang/language/issues/2020
2022-11-30 09:40:40 +00:00
- **Breaking Change** [#50383][]: Report a compile-time error for all cyclic
dependencies during top-level type inference.
Previously, some of these dependencies were ignored, based on an analysis
2022-12-07 20:39:10 +00:00
determining that they could not influence the inferred type. However, this
analysis was complex, differed slightly among tools, and had become much more
complex due to other changes (especially, enhanced flow analysis).
2022-11-30 09:40:40 +00:00
2022-12-07 20:39:10 +00:00
With this change, all tools treat these cyclic dependencies in the same way,
the analysis is well-understood, and, arguably, the code is more readable.
2022-11-30 09:40:40 +00:00
2022-12-07 20:39:10 +00:00
Breakage is mitigated by adding a declared type to one top-level declaration
per cycle which is now an error.
2022-11-30 09:40:40 +00:00
[#50383]: https://github.com/dart-lang/sdk/issues/50383
2022-10-25 21:10:57 +00:00
- Add support for **unnamed libraries** . Dart language 2.19 allows a library
directive to be written without a name (`library;`). A library directive can
be used for library-level annotations (such as `@deprecated` ) and for
library-level documentation comments, and with this new feature, you don't
have to provide a unique name for each library directive. Instead, a name can
2022-11-17 21:59:28 +00:00
simply be omitted (see [#1073][]).
2022-11-24 15:05:13 +00:00
2022-11-17 21:59:28 +00:00
[#1073]: https://github.com/dart-lang/language/issues/1073
2022-10-25 21:10:57 +00:00
2022-06-16 11:39:30 +00:00
### Libraries
2022-08-09 10:21:22 +00:00
#### `dart:convert`
2022-12-07 20:39:10 +00:00
- **Breaking change** [#34233]: The previously deprecated API
[`DEFAULT_BUFFER_SIZE`] in `JsonUtf8Encoder` has been removed.
2022-08-09 10:21:22 +00:00
[#34233]: https://github.com/dart-lang/sdk/issues/34233
[`DEFAULT_BUFFER_SIZE`]: https://api.dart.dev/stable/2.17.6/dart-convert/JsonUtf8Encoder/DEFAULT_BUFFER_SIZE-constant.html
2022-07-12 15:40:12 +00:00
2022-10-25 12:25:35 +00:00
#### `dart:core`
2022-10-26 21:13:05 +00:00
- Deprecated `FallThroughError` . Has not been thrown since Dart 2.0
(see [#49529]).
- Added `copyWith` extension method on `DateTime` (see [#24644]).
2022-11-08 19:02:35 +00:00
- Deprecated `RangeError.checkValidIndex` in favor of `IndexError.check` .
- Deprecated `IndexError` constructor in favor of `IndexError.withLength`
constructor.
2022-11-24 15:05:13 +00:00
- Deprecated `NullThrownError` and `CyclicInitializationError` .
Neither error is thrown by null safe code.
2022-10-26 21:13:05 +00:00
[#49529]: https://github.com/dart-lang/sdk/issues/49529
[#24644]: https://github.com/dart-lang/sdk/issues/24644
2022-10-25 12:25:35 +00:00
2022-07-19 07:58:08 +00:00
#### `dart:developer`
2022-12-07 20:39:10 +00:00
- **Breaking change** [#34233]: The previously deprecated APIs `kInvalidParams` ,
`kExtensionError` , `kExtensionErrorMax` , and `kExtensionErrorMin` in
[`ServiceExtensionResponse`] have been removed. They have been replaced by
`invalidParams` , `extensionError` , `extensionErrorMax` , and
`extensionErrorMin` .
2022-08-30 19:16:28 +00:00
- Deprecated `UserTag.MAX_USER_TAGS` in favor of `UserTag.maxUserTags` .
2022-07-19 07:58:08 +00:00
[#34233]: https://github.com/dart-lang/sdk/issues/34233
2022-08-09 10:21:22 +00:00
[`ServiceExtensionResponse`]: https://api.dart.dev/stable/2.17.6/dart-developer/ServiceExtensionResponse-class.html#constants
2022-07-19 07:58:08 +00:00
2022-11-28 09:45:45 +00:00
#### `dart:ffi`
2022-12-07 20:39:10 +00:00
- **Breaking change** [#49935]: The runtime type argument of `Pointer` has
2022-11-28 09:45:45 +00:00
changed to `Never` in preparation of completely removing the runtime type
argument. `Pointer.toString` has changed to not report any type argument.
[#49935]: https://github.com/dart-lang/sdk/issues/49935
2022-07-20 18:28:35 +00:00
2022-07-28 16:07:30 +00:00
#### `dart:html`
2022-08-30 19:16:28 +00:00
- Add constructor and `slice` to `SharedArrayBuffer` .
2022-07-28 16:07:30 +00:00
- Deprecated `registerElement` and `registerElement2` in `Document` and
`HtmlDocument` . These APIs were based on the deprecated Web Components v0.5
specification and are not supported by browsers today. These APIs are expected
2022-12-07 20:39:10 +00:00
to be deleted in a future release. See the related breaking change request
[#49536 ](https://github.com/dart-lang/sdk/issues/49536 ).
2022-07-28 16:07:30 +00:00
2022-08-30 19:16:28 +00:00
#### `dart:io`
2022-09-21 09:49:30 +00:00
- **Breaking change** [#49305 ](https://github.com/dart-lang/sdk/issues/49305 ):
2022-08-30 19:16:28 +00:00
Disallow negative or hexadecimal content-length headers.
2022-09-21 09:49:30 +00:00
- **Breaking change** [#49647 ](https://github.com/dart-lang/sdk/issues/49647 ):
2022-12-07 20:39:10 +00:00
`File.create` now takes new optional `exclusive` `bool` parameter, and when it
is `true` the operation will fail if target file already exists.
- **Breaking change** [#49878]: Calling `ResourceHandle.toFile()` ,
2022-10-26 20:41:31 +00:00
`ResourceHandle.toSocket()` , `ResourceHandle.toRawSocket()` or
`ResourceHandle.toRawDatagramSocket()` , more than once now throws a
`StateError` .
The previous behavior would allow multiple Dart objects to refer to the same
file descriptor, which would produce errors when one object was closed or
garbage collected.
[#49878]: https://github.com/dart-lang/sdk/issues/49878
2022-08-26 20:43:13 +00:00
2022-12-07 20:39:10 +00:00
- Adds three new `FileSystemException` subclasses to handle common error cases:
2022-11-30 04:54:52 +00:00
- `PathAccessException` : The necessary access rights are not available.
- `PathExistsException` : The path being created already exists.
- `PathNotFoundException` : The path being accessed does not exist.
2022-11-08 19:26:19 +00:00
[#12461]: https://github.com/dart-lang/sdk/issues/12461
2022-11-30 04:54:52 +00:00
[#50436]: https://github.com/dart-lang/sdk/issues/50436
2022-11-08 19:26:19 +00:00
2022-08-18 10:42:55 +00:00
#### `dart:isolate`
- Add `Isolate.run` to run a function in a new isolate.
2022-12-19 16:03:46 +00:00
- **Breaking change**: `SendPort.send` is again applying strict checks to the
contents of the message when sending messages between isolates that are not
known to share the same code (e.g. an isolate spawned via `Isolate.spawnUri` ).
These checks were accidentally relaxed in an earlier Dart version allowing
all classes from `dart:core` and `dart:collection` through. This for
example means that you can't send an instance of a `HashMap` to an isolate
spawned via `Isolate.spawnUri` . See [`SendPort.send`] documentation for
the full list of restrictions.
[`SendPort.send`]: https://api.dart.dev/stable/dart-isolate/SendPort/send.html
2022-08-18 10:42:55 +00:00
2022-08-30 19:16:28 +00:00
#### `dart:mirrors`
2022-12-07 20:39:10 +00:00
- **Breaking change** [#34233]: The APIs [`MirrorsUsed`] and [`Comment`] have
been removed. `MirrorsUsed` was experimental and deprecated; `Comment` was
previously used internally in dart2js. Both are no longer functional.
2022-08-30 19:16:28 +00:00
[#34233]: https://github.com/dart-lang/sdk/issues/34233
[`MirrorsUsed`]: https://api.dart.dev/stable/dart-mirrors/MirrorsUsed-class.html
[`Comment`]: https://api.dart.dev/stable/dart-mirrors/Comment-class.html
2022-10-18 17:47:29 +00:00
### Other libraries
#### `package:js`
2022-10-18 17:47:29 +00:00
- **Breaking changes to the preview feature `@staticInterop` **:
- Classes with this annotation are now disallowed from using `external`
2022-12-07 20:39:10 +00:00
generative constructors. Use `external factory` s for these classes instead,
and the behavior should be identical. This includes use of synthetic
constructors. See [#48730] and [#49941] for more details.
2022-10-18 17:47:29 +00:00
- Classes with this annotation's external extension members are now disallowed
2022-12-07 20:39:10 +00:00
from using type parameters e.g. `external void method<T>(T t)` . Use a
non-`external` extension method for type parameters instead. See [#49350]
for more details.
2022-11-21 20:19:06 +00:00
- Classes with this annotation should also have the `@JS` annotation. You can
2022-12-07 20:39:10 +00:00
also have the `@anonymous` annotation with these two annotations for an
object literal constructor, but it isn't required.
2022-11-21 20:19:06 +00:00
- Classes with this annotation can not be implemented by classes without this
2022-12-07 20:39:10 +00:00
annotation. This is to avoid confusing type behavior.
2022-10-18 17:47:29 +00:00
[#48730]: https://github.com/dart-lang/sdk/issues/48730
2022-11-28 23:41:02 +00:00
[#49941]: https://github.com/dart-lang/sdk/issues/49941
2022-10-18 17:47:29 +00:00
[#49350]: https://github.com/dart-lang/sdk/issues/49350
2022-10-18 17:47:29 +00:00
2022-07-11 20:00:21 +00:00
### Tools
2022-08-30 14:14:18 +00:00
#### Analyzer
2022-11-29 22:47:58 +00:00
- add static enforcement of new `mustBeOverridden` annotation, and quick fixes
- add quick fixes for many diagnostics including compile-time errors, hints, and
lints. There are now quick fixes for over 300 diagnostic codes. These lint
rules have new fixes: `combinators_ordering` , `dangling_library_doc_comments` ,
`implicit_call_tearoffs` , `library_annotations` , and
`unnecessary_library_directive` .
- add new hints: `body_might_complete_normally_catch_error` ,
`cast_from_null_always_fails` , `cast_from_nullable_always_fails` ,
`deprecated_colon_for_default_value` , and `duplicate_export`
2022-10-25 20:04:28 +00:00
- remove hint: `invalid_override_different_default_values`
2022-08-30 14:14:18 +00:00
2022-07-11 20:00:21 +00:00
#### Linter
2022-11-30 02:11:07 +00:00
Updated the Linter to `1.31.0` , which includes changes that
2022-11-07 22:02:42 +00:00
2022-12-07 20:39:10 +00:00
- add new lint: `collection_methods_unrelated_type` .
- add new lint: `combinators_ordering` .
- add new lint: `dangling_library_doc_comments` .
2022-11-09 23:25:29 +00:00
- add new lint: `enable_null_safety` .
2022-12-07 20:39:10 +00:00
- add new lint: `implicit_call_tearoffs` .
2022-11-09 23:25:29 +00:00
- add new lint: `library_annotations` .
2022-12-07 20:39:10 +00:00
- add new lint: `unnecessary_library_directive` .
- add new lint: `unreachable_from_main` .
- add new lint: `use_string_in_part_of_directives` .
2022-11-07 22:02:42 +00:00
- fix `no_leading_underscores_for_local_identifiers` to not report super formals
as local variables.
- fix `unnecessary_overrides` false negatives.
- fix `cancel_subscriptions` for nullable fields.
- update `library_names` to support unnamed libraries.
- fix `unnecessary_parenthesis` support for as-expressions.
- fix `use_build_context_synchronously` to check for context property accesses.
- fix false positive in `comment_references` .
- improved unrelated type checks to handle enums and cascades.
- fix `unnecessary_brace_in_string_interps` for `this` expressions .
- update `use_build_context_synchronously` for `BuildContext.mounted` .
- improve `flutter_style_todos` to handle more cases.
- fix `use_build_context_synchronously` to check for `BuildContext` s in named
expressions.
- fix `exhaustive_cases` to check parenthesized expressions
2022-09-02 15:46:23 +00:00
- update `avoid_redundant_argument_values` to work with enum declarations.
2022-08-18 10:42:55 +00:00
- fix `avoid_redundant_argument_values` when referencing required
2022-08-08 21:40:30 +00:00
parameters in legacy libraries.
- fix `use_super_parameters` false positives with repeated super
parameter references.
- update `use_late_for_private_fields_and_variables` to handle enums.
- fix `prefer_contains` false positives when a start index is non-zero.
- improve `noop_primitive_operations` to catch `.toString()`
in string interpolations.
- update `public_member_api_docs` to report diagnostics on extension
names (instead of bodies).
2022-07-11 20:00:21 +00:00
- fix `use_colored_box` and `use_decorated_box` to not over-report on containers without
a child.
- fix `unnecessary_parenthesis` false positives on a map-or-set literal at the start of
an expression statement.
- fix `prefer_final_locals` false positives reporting on fields.
- fix `unnecessary_overrides` to allow overrides on `@Protected` members.
- fix `avoid_multiple_declarations_per_line` false positives in `for` statements.
- fix `prefer_final_locals` false positives on declaration lists with at least one
non-final variable.
- fix`use_build_context_synchronously` to handle `await` s in `if` conditions.
2022-12-07 20:39:10 +00:00
- improves performance for:
- `avoid_escaping_inner_quotes` .
- `avoid_null_checks_in_equality_operators` .
- `avoid_positional_boolean_parameters` .
- `avoid_returning_null` .
- `avoid_returning_null` .
- `avoid_returning_this` .
- `cascade_invocations` .
- `diagnostic_describe_all_properties` .
- `flutter_style_todos` .
- `join_return_with_statement` .
- `parameter_assignments` .
- `prefer_const_constructors` .
- `prefer_constructors_over_static_methods` .
- `prefer_constructors_over_static_methods` .
- `prefer_contains` .
- `prefer_foreach` .
- `prefer_interpolation_to_compose_strings` .
- `prefer_interpolation_to_compose_strings` .
- `recursive_getters` .
- `tighten_type_of_initializing_formals` .
- `unnecessary_lambdas` .
- `use_late_for_private_fields_and_variables` .
2022-07-11 20:00:21 +00:00
2022-08-04 13:38:46 +00:00
#### Pub
2022-10-18 12:17:31 +00:00
- Treats packages with sdk constraint lower bound `>=2.12.0` or more and upper
bound `<3.0.0` as compatible with `<4.0.0` .
2022-10-18 14:42:34 +00:00
- Introduces content-hashes in pubspec.lock, to protect against corrupted
package repositories.
These will show up in the lock file on the first run of `dart pub get` .
See https://dart.dev/go/content-hashes for more details.
2022-11-25 11:13:03 +00:00
- New flag `dart pub get --enforce-lockfile` will fetch dependencies, but fail
if anything deviates from `pubspec.lock` . Useful for ensuring reproducible runs
in CI and production.
2022-08-04 13:38:46 +00:00
- Remove remaining support for `.packages` files. The flag
`--legacy-packages-file` is no longer supported.
2022-10-18 14:42:34 +00:00
- The client will now default to the `pub.dev` repository instead of `pub.dartlang.org` .
2022-11-25 11:13:03 +00:00
This will cause a change in `pubspec.lock` .
- Support a new field [`funding` ](https://dart.dev/tools/pub/pubspec#funding ) in `pubspec.yaml` .
2022-10-04 10:11:57 +00:00
- Validate the CRC32c checksum of downloaded archives and retry on failure.
- `dart pub add foo:<constraint>` with an existing dependency will now update
the constraint rather than fail.
2022-11-25 11:13:03 +00:00
- Update `dart pub publish` to allow `dependency_overrides` in `pubspec.yaml` .
2022-10-04 10:11:57 +00:00
They will still cause a publication warning.
Note that only `dependency_overrides` from the root package effect resolution.
- Update `dart pub publish` to require a working resolution.
If publishing a breaking release of mutually dependent packages use `dependency_overrides`
to obtain a resolution.
2022-12-12 11:46:58 +00:00
- `dart pub add` will now allow adding multiple packages from any source using
2022-12-07 20:39:10 +00:00
the same YAML syntax as in `pubspec.yaml` .
2022-11-25 11:13:03 +00:00
For example:
2022-12-07 20:39:10 +00:00
```console
2022-11-25 11:13:03 +00:00
$ dart pub add retry:^1.0.0 'dev:foo{"git":"https://github.com/foo/foo"}'
```
2022-10-18 12:17:31 +00:00
- `dart pub publish` will now give a warning if `dart analyze` reports any diagnostics.
2022-10-04 10:11:57 +00:00
- `dart pub get` now fails gracefully when run from inside the pub-cache.
- `dart pub publish` now shows the file sizes of large files in your package to
prevent accidental publication of large unrelated files.
- Fix a bug in `dart pub upgrade --major-versions` where packages not requiring
major updates would be held back unless needed.
2022-08-04 13:38:46 +00:00
2022-08-16 00:01:26 +00:00
#### dart2js
- **Breaking change** [49473 ](https://github.com/dart-lang/sdk/issues/49473 ):
dart2js no longer supports HTTP URIs as inputs.
2022-12-01 13:54:43 +00:00
## 2.18.5 - 2022-11-23
- fixes an error on private variable setters in mixins on dart web
(issue [#50119][]).
- fixes the handling of type parameter nullability in factory constructors
(issue [#50392][]).
[#50119]: https://github.com/dart-lang/sdk/issues/50119
[#50392]: https://github.com/dart-lang/sdk/issues/50392
2022-11-01 12:51:00 +00:00
## 2.18.4 - 2022-11-02
This is a patch release that fixes crashes during hot reload
(issue [flutter/flutter#113540][]).
[flutter/flutter#113540]: https://github.com/flutter/flutter/issues/113540
2022-10-17 13:08:05 +00:00
## 2.18.3 - 2022-10-19
This is a patch release that fixes a regression in code coverage computation
(issue [#49887][]).
[#49887]: https://github.com/dart-lang/sdk/issues/49887
2022-09-26 10:06:44 +00:00
## 2.18.2 - 2022-09-28
2022-09-27 11:07:48 +00:00
This is a patch release that:
- fixes incorrect behavior in `Uri.parse` .
- fixes a compiler crash (issue [#50052][]).
2022-09-26 10:06:44 +00:00
### Libraries
#### `dart:core`
2022-10-27 15:10:25 +00:00
- **Security advisory** [CVE-2022-3095 ](https://github.com/dart-lang/sdk/security/advisories/GHSA-m9pm-2598-57rj ):
There is a auth bypass vulnerability in Dart SDK, specifically `dart:uri` core
library, used to parse and validate URLs. This library is vulnerable to the
backslash-trick wherein backslash is not recognized as equivalent to forward
slash in URLs.
The `Uri` class has been changed to parse a backslash in the path or the
authority separator of a URI as a forward slash. This affects the `Uri`
constructor's `path` parameter, and the `Uri.parse` method.
2022-09-26 10:06:44 +00:00
This change was made to not diverge as much from the browser `URL` behavior.
The Dart `Uri` class is still not an implementation of the same standard
as the browser's `URL` implementation.
2022-09-27 11:07:48 +00:00
[#50052]: https://github.com/dart-lang/sdk/issues/50052
2022-09-13 07:58:49 +00:00
## 2.18.1 - 2022-09-14
This is a patch release that fixes a crash caused by incorrect type inference
(issues [flutter/flutter#110715][] and [flutter/flutter#111088][]).
[flutter/flutter#110715]: https://github.com/flutter/flutter/issues/110715
[flutter/flutter#111088]: https://github.com/flutter/flutter/issues/111088
## 2.18.0 - 2022-08-30
2022-04-06 23:26:47 +00:00
2022-05-24 13:54:23 +00:00
### Language
The following features are new in the Dart 2.18 [language version][]. To use
them, you must set the lower bound on the SDK constraint for your package to
2.18 or greater (`sdk: '>=2.18.0 < 3.0.0 ' ` ) .
[language version]: https://dart.dev/guides/language/evolution
2022-08-18 10:42:55 +00:00
- ** [Enhanced type inference for generic invocations with function literals][]**:
2022-07-19 08:03:54 +00:00
Invocations of generic methods/constructors that supply function literal
arguments now have improved type inference. This primarily affects the
`Iterable.fold` method. For example, in previous versions of Dart, the
compiler would fail to infer an appropriate type for the parameter `a` :
2022-05-24 13:54:23 +00:00
```dart
void main() {
List< int > ints = [1, 2, 3];
var maximum = ints.fold(0, (a, b) => a < b ? b : a ) ;
}
```
With this improvement, `a` receives its type from the initial value, `0` .
On rare occasions, the wrong type will be inferred, leading to a compile-time
error, for example in this code, type inference will infer that `a` has a
type of `Null` :
```dart
void main() {
List< int > ints = [1, 2, 3];
var maximumOrNull = ints.fold(null,
(a, b) => a == null || a < b ? b : a ) ;
}
```
This can be worked around by supplying the appropriate type as an explicit
type argument to `fold` :
```dart
void main() {
List< int > ints = [1, 2, 3];
var maximumOrNull = ints.fold< int ? > (null,
(a, b) => a == null || a < b ? b : a ) ;
}
```
2022-07-19 08:03:54 +00:00
[Enhanced type inference for generic invocations with function literals]: https://github.com/dart-lang/language/issues/731
2022-05-24 13:54:23 +00:00
2022-07-14 14:13:28 +00:00
- **Breaking Change** [#48167 ](https://github.com/dart-lang/sdk/issues/48167 ):
Mixin of classes that don't extend `Object` is no longer supported:
```dart
class Base {}
class Mixin extends Base {}
class C extends Base with Mixin {}
```
This should instead be written using a mixin declaration of `Mixin` :
```dart
class Base {}
mixin Mixin on Base {}
class C extends Base with Mixin {}
```
This feature has not been supported in most compilation targets for some
time but is now completely removed.
2022-04-06 23:26:47 +00:00
### Core libraries
2022-07-14 14:13:28 +00:00
#### `dart:async`
- The `Stream.fromIterable` stream can now be listened to more than once.
2022-08-30 19:16:28 +00:00
#### `dart:collection`
2022-07-14 14:13:28 +00:00
- Deprecates `BidirectionalIterator` .
2022-08-30 19:16:28 +00:00
#### `dart:core`
- Allow omitting the `unencodedPath` positional argument to `Uri.http` and
`Uri.https` to default to an empty path.
2022-04-06 23:26:47 +00:00
#### `dart:html`
- Add `connectionState` attribute and `connectionstatechange` listener to
`RtcPeerConnection` .
[io] Don't restore terminal state on exit.
This is breaking change #45630.
The Dart VM has until now restored the terminal settings upon exit to
their initial values for stdin, stdout, and stderr. This change removes
that automatic behavior in favor of having the program do the
restoration. Previously the intention was that dart programs can
enable/disable echoing and line buffering and not worry about restoring
the original settings.
However, the VM doing so unconditionally leads to undesirable behavior
e.g. when the program does not care about terminal settings and is
sharing a process group with a program that does care. E.g. if dart's
output is piped into less(1), then there is a race condition where dart
might see the raw terminal settings set by less(1), and if the dart VM
exits after less(1) has exited, then it will restore the raw terminal
settings, leaving the user with a seemingly defective shell with echo
disabled. This race condition can be reproduced using:
cat > yes.dart << EOF
main() {
for (int i = 0; i < 1000000; i++) {
print("yes");
}
}
EOF
stty; (sleep 1 && dart yes.dart) | less; stty; stty sane
The user will end up with a shell with echo behavior disabled. The stty
command shows the current terminal settings, where the difference can be
seen, and 'stty sane' fixes the settings before returning to the shell
prompt. The 'stty sane' call can be omitted to see the defective shell
prompt.
This change removes the terminal restoring behavior (added in Dart
2.0.0) and instead asks applications to do the restoration themselves.
The new design matches how programs in other programming languages
implement interactive input that changes terminal settings.
Furthermore the `echoMode` setting now only controls the `echo` local
mode and no longer sets the `echonl` local mode on POSIX systems (which
controls whether newline are echoed even if the regular echo mode is
disabled). The `echonl` local mode is usually turned off in common shell
environments. Programs that wish to control the `echonl` local mode can
use the new `echoNewlineMode` setting. This change is required to
prevent the reoccurence of #30318 when programs manually restore
`echoMode`.
Windows has further considerations: It also saves the console code pages
and restore them if they were not UTF-8. This behavior is retained as it
is useful and needed for Dart's output to function properly. ANSI output
sequences are also turned on via ENABLE_VIRTUAL_TERMINAL_PROCESSING,
which is slightly changed in this change to only rsetore that setting if
it wasn't already on for consistency.
Closes https://github.com/dart-lang/sdk/issues/36453
Closes https://github.com/dart-lang/sdk/issues/45630
TEST=Reproduced with less as above
Change-Id: I2991f9c7f47b97fe475c1ad6edeb769024f8d0db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190484
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-05-31 15:36:33 +00:00
#### `dart:io`
2022-06-09 19:28:25 +00:00
- **Breaking Change** [#49045 ](https://github.com/dart-lang/sdk/issues/49045 ):
The `uri` property of `RedirectException` in `dart:io` has been changed to
be nullable. Programs must be updated to handle the `null` case.
2022-06-08 16:57:32 +00:00
- **Breaking Change** [#34218 ](https://github.com/dart-lang/sdk/issues/34218 ):
Constants in `dart:io` 's networking APIs following the `SCREAMING_CAPS`
convention have been removed (they were previously deprecated). Please use
the corresponding `lowerCamelCase` constants instead.
[io] Don't restore terminal state on exit.
This is breaking change #45630.
The Dart VM has until now restored the terminal settings upon exit to
their initial values for stdin, stdout, and stderr. This change removes
that automatic behavior in favor of having the program do the
restoration. Previously the intention was that dart programs can
enable/disable echoing and line buffering and not worry about restoring
the original settings.
However, the VM doing so unconditionally leads to undesirable behavior
e.g. when the program does not care about terminal settings and is
sharing a process group with a program that does care. E.g. if dart's
output is piped into less(1), then there is a race condition where dart
might see the raw terminal settings set by less(1), and if the dart VM
exits after less(1) has exited, then it will restore the raw terminal
settings, leaving the user with a seemingly defective shell with echo
disabled. This race condition can be reproduced using:
cat > yes.dart << EOF
main() {
for (int i = 0; i < 1000000; i++) {
print("yes");
}
}
EOF
stty; (sleep 1 && dart yes.dart) | less; stty; stty sane
The user will end up with a shell with echo behavior disabled. The stty
command shows the current terminal settings, where the difference can be
seen, and 'stty sane' fixes the settings before returning to the shell
prompt. The 'stty sane' call can be omitted to see the defective shell
prompt.
This change removes the terminal restoring behavior (added in Dart
2.0.0) and instead asks applications to do the restoration themselves.
The new design matches how programs in other programming languages
implement interactive input that changes terminal settings.
Furthermore the `echoMode` setting now only controls the `echo` local
mode and no longer sets the `echonl` local mode on POSIX systems (which
controls whether newline are echoed even if the regular echo mode is
disabled). The `echonl` local mode is usually turned off in common shell
environments. Programs that wish to control the `echonl` local mode can
use the new `echoNewlineMode` setting. This change is required to
prevent the reoccurence of #30318 when programs manually restore
`echoMode`.
Windows has further considerations: It also saves the console code pages
and restore them if they were not UTF-8. This behavior is retained as it
is useful and needed for Dart's output to function properly. ANSI output
sequences are also turned on via ENABLE_VIRTUAL_TERMINAL_PROCESSING,
which is slightly changed in this change to only rsetore that setting if
it wasn't already on for consistency.
Closes https://github.com/dart-lang/sdk/issues/36453
Closes https://github.com/dart-lang/sdk/issues/45630
TEST=Reproduced with less as above
Change-Id: I2991f9c7f47b97fe475c1ad6edeb769024f8d0db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190484
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-05-31 15:36:33 +00:00
- **Breaking Change** [#45630][]: The Dart VM no longer automatically restores
the initial terminal settings upon exit. Programs that change the `Stdin`
settings `lineMode` and `echoMode` are now responsible for restoring the
settings upon program exit. E.g. a program disabling `echoMode` will now
need to restore the setting itself and handle exiting by the appropriate
signals if desired:
```dart
import 'dart:io';
import 'dart:async';
main() {
bool echoWasEnabled = stdin.echoMode;
try {
late StreamSubscription subscription;
subscription = ProcessSignal.sigint.watch().listen((ProcessSignal signal) {
stdin.echoMode = echoWasEnabled;
subscription.cancel();
Process.killPid(pid, signal); /* Die by the signal. */
});
stdin.echoMode = false;
} finally {
stdin.echoMode = echoWasEnabled;
}
}
```
This change is needed to fix [#36453][] where the dart programs not caring
2023-01-24 18:00:25 +00:00
about the terminal settings can inadvertently corrupt the terminal settings
[io] Don't restore terminal state on exit.
This is breaking change #45630.
The Dart VM has until now restored the terminal settings upon exit to
their initial values for stdin, stdout, and stderr. This change removes
that automatic behavior in favor of having the program do the
restoration. Previously the intention was that dart programs can
enable/disable echoing and line buffering and not worry about restoring
the original settings.
However, the VM doing so unconditionally leads to undesirable behavior
e.g. when the program does not care about terminal settings and is
sharing a process group with a program that does care. E.g. if dart's
output is piped into less(1), then there is a race condition where dart
might see the raw terminal settings set by less(1), and if the dart VM
exits after less(1) has exited, then it will restore the raw terminal
settings, leaving the user with a seemingly defective shell with echo
disabled. This race condition can be reproduced using:
cat > yes.dart << EOF
main() {
for (int i = 0; i < 1000000; i++) {
print("yes");
}
}
EOF
stty; (sleep 1 && dart yes.dart) | less; stty; stty sane
The user will end up with a shell with echo behavior disabled. The stty
command shows the current terminal settings, where the difference can be
seen, and 'stty sane' fixes the settings before returning to the shell
prompt. The 'stty sane' call can be omitted to see the defective shell
prompt.
This change removes the terminal restoring behavior (added in Dart
2.0.0) and instead asks applications to do the restoration themselves.
The new design matches how programs in other programming languages
implement interactive input that changes terminal settings.
Furthermore the `echoMode` setting now only controls the `echo` local
mode and no longer sets the `echonl` local mode on POSIX systems (which
controls whether newline are echoed even if the regular echo mode is
disabled). The `echonl` local mode is usually turned off in common shell
environments. Programs that wish to control the `echonl` local mode can
use the new `echoNewlineMode` setting. This change is required to
prevent the reoccurence of #30318 when programs manually restore
`echoMode`.
Windows has further considerations: It also saves the console code pages
and restore them if they were not UTF-8. This behavior is retained as it
is useful and needed for Dart's output to function properly. ANSI output
sequences are also turned on via ENABLE_VIRTUAL_TERMINAL_PROCESSING,
which is slightly changed in this change to only rsetore that setting if
it wasn't already on for consistency.
Closes https://github.com/dart-lang/sdk/issues/36453
Closes https://github.com/dart-lang/sdk/issues/45630
TEST=Reproduced with less as above
Change-Id: I2991f9c7f47b97fe475c1ad6edeb769024f8d0db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190484
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-05-31 15:36:33 +00:00
when e.g. piping into less.
Furthermore the `echoMode` setting now only controls the `echo` local mode
and no longer sets the `echonl` local mode on POSIX systems (which controls
whether newline are echoed even if the regular echo mode is disabled). The
`echonl` local mode is usually turned off in common shell environments.
Programs that wish to control the `echonl` local mode can use the new
`echoNewlineMode` setting.
The Windows console code pages (if not UTF-8) and ANSI escape code support
(if disabled) remain restored when the VM exits.
[#45630]: https://github.com/dart-lang/sdk/issues/45630
[#36453]: https://github.com/dart-lang/sdk/issues/36453
2022-05-16 21:31:47 +00:00
#### `dart:js_util`
- Added `dartify` and a number of minor helper functions.
2022-07-14 14:13:28 +00:00
### Dart VM
Implementation of `async` /`async*`/`sync*` is revamped in Dart VM,
both in JIT and AOT modes. This also affects Flutter except Flutter Web.
Besides smaller code size and better performance of async methods,
the new implementation carries a few subtle changes in behavior:
2022-08-22 08:36:37 +00:00
- If `async` method returns before reaching the first `await` , it now
returns a completed Future.
2022-07-14 14:13:28 +00:00
Previously `async` methods completed resulting Future in separate microtasks.
- Stack traces no longer have duplicate entries for `async` methods.
- New implementation now correctly throws an error if `null` occurs as
an argument of a logical expression (`&& ` and `||` ) which also contains
an `await` .
- New implementation avoids unnecessary extending the liveness of local
variables in `async` /`async*`/`sync*` methods, which means that unused
objects stored in local variables in such methods might be garbage
collected earlier than they were before
2022-08-22 08:36:37 +00:00
(see issue [#36983 ](https://github.com/dart-lang/sdk/issues/36983 )
for details).
2022-07-14 14:13:28 +00:00
2022-05-11 18:46:44 +00:00
### Tools
2022-07-19 08:03:54 +00:00
#### General
- **Breaking Change** [#48272 ](https://github.com/dart-lang/sdk/issues/48272 ):
The `.packages` file has been fully discontinued. Historically when the
commands `dart pub get` or `flutter pub get` are executed, pub resolved all
dependencies, and installs those dependencies to the local pub cache. It
furthermore created a mapping from each used package to their location on the
local file system, and wrote that into two files:
* `.dart_tool/package_config.json`
* `.packages` (deprecated in Dart 2.8.0)
As of Dart 2.18.0, the `.packages` is now fully desupported, and all tools
distributed in, and based on, the Dart SDK no longer support it, and thus
solely use the `.dart_tool/package_config.json` file. If you've run `dart pub
get` or `flutter pub get` with any Dart SDK from the past few years you
already have a `.dart_tool/package_config.json` and thus should not be
impacted. You can delete any old `.packages` files.
If you have any third-party tools that for historical reasons depend on a
`.packages` we will support the ability to generate a `.packages` by passing
the flag `--legacy-packages-file` to `dart pub get` . This support will be
removed in a following stable release.
2022-06-14 18:29:17 +00:00
#### Dart command line
- **Breaking change** [#46100 ](https://github.com/dart-lang/sdk/issues/46100 ):
The standalone `dart2js` and `dartdevc` tools have been removed as previously
announced. `dart2js` is replaced by the `dart compile js` command, `dartdevc`
is no longer exposed as a command-line tool.
2022-07-14 14:13:28 +00:00
- **Breaking change** [#46100 ](https://github.com/dart-lang/sdk/issues/46100 ):
The standalone `dartanalyzer` tool has been removed as previously
announced. `dartanalyzer` is replaced by the `dart analyze` command.
2022-08-30 14:14:18 +00:00
#### Analyzer
- added quick fixes for diagnostics: `abstract_field_constructor_initializer` ,
`abstract_class_member` ,
[`always_put_control_body_on_new_line` ](https://dart-lang.github.io/linter/lints/always_put_control_body_on_new_line.html ),
[`avoid_print` ](https://dart-lang.github.io/linter/lints/avoid_print.html ),
[`avoid_renaming_method_parameters` ](https://dart-lang.github.io/linter/lints/avoid_renaming_method_parameters.html ),
[`discarded_futures` ](https://dart-lang.github.io/linter/lints/discarded_futures.html ),
`enum_with_abstract_member` , `non_bool_condition` ,
`super_formal_parameter_without_associated_named` ,
[`unawaited_futures` ](https://dart-lang.github.io/linter/lints/unawaited_futures.html ),
`unnecessary_final` `unused_element_parameter` ,
- added new Hint: `deprecated_export_use`
2022-05-11 18:46:44 +00:00
#### Linter
2022-06-07 17:59:29 +00:00
Updated the Linter to `1.25.0` , which includes changes that
- add new lint: `discarded_futures` .
2022-12-07 20:39:10 +00:00
- add new lint: `unnecessary_null_aware_operator_on_extension_on_nullable` .
- add new lint: `unnecessary_to_list_in_spreads` .
2022-06-07 17:59:29 +00:00
- improve message and highlight range for `no_duplicate_case_values`
- improve performance for `lines_longer_than_80_chars` ,
`prefer_const_constructors_in_immutables` , and
`prefer_initializing_formals` .
- fix `prefer_final_parameters` to support super parameters.
- fix `unawaited_futures` to handle string interpolated
2022-05-19 00:20:30 +00:00
futures.
2022-06-07 17:59:29 +00:00
- update `use_colored_box` to not flag nullable colors,
- fix `no_leading_underscores_for_local_identifiers`
2022-05-11 18:46:44 +00:00
to lint local function declarations.
2022-06-07 17:59:29 +00:00
- fix `avoid_init_to_null` to correctly handle super
2022-05-11 18:46:44 +00:00
initializing defaults that are non-null.
2022-06-07 17:59:29 +00:00
- update `no_leading_underscores_for_local_identifiers`
2022-05-11 18:46:44 +00:00
to allow identifiers with just underscores.
2022-06-07 17:59:29 +00:00
- fix `flutter_style_todos` to support usernames that
2022-05-11 18:46:44 +00:00
start with a digit.
2022-06-07 17:59:29 +00:00
- update `require_trailing_commas` to handle functions
2022-05-11 18:46:44 +00:00
in asserts and multi-line strings.
2022-06-07 17:59:29 +00:00
- update `unsafe_html` to allow assignments to
2022-05-11 18:46:44 +00:00
`img.src` .
2022-06-07 17:59:29 +00:00
- fix `unnecessary_null_checks` to properly handle map
2022-05-11 18:46:44 +00:00
literal entries.
2022-05-12 12:06:45 +00:00
#### Pub
2022-07-19 08:03:54 +00:00
* `dart pub get` and `dart pub upgrade` no longer create the
`.packages` file. For details, see breaking change #48272 above.
2022-05-12 12:06:45 +00:00
* `dart pub outdated` now shows which of your dependencies are discontinued.
2022-06-13 08:39:56 +00:00
* `dart pub publish` will now list all the files it is about to publish.
2022-05-12 12:06:45 +00:00
2022-08-22 08:36:37 +00:00
## 2.17.7 - 2022-08-24
This is a patch release that:
- fixes a crash in the debugger (issue [#49209][]).
[#49209]: https://github.com/dart-lang/sdk/issues/49209
2022-07-12 10:06:12 +00:00
## 2.17.6 - 2022-07-13
This is a patch release that:
2022-08-22 08:36:37 +00:00
- improves code completion for Flutter (issue [#49054][]).
- fixes a crash on ARM (issue [#106510][]).
- fixes a compiler crash with Finalizable parameters (issue [#49402][]).
2022-07-12 10:06:12 +00:00
[#49054]: https://github.com/dart-lang/sdk/issues/49054
[#106510]: https://github.com/flutter/flutter/issues/106510
[#49402]: https://github.com/dart-lang/sdk/issues/49402
2022-06-27 08:35:29 +00:00
## 2.17.5 - 2022-06-22
2022-06-20 14:36:33 +00:00
2022-07-12 10:06:12 +00:00
This is a patch release that:
2022-06-20 14:36:33 +00:00
2022-08-22 08:36:37 +00:00
- improves analysis of enums and switch (issue [#49188][]).
- fixes a compiler crash when initializing Finalizable objects
(issue [#49075][]).
2022-06-20 14:36:33 +00:00
[#49188]: https://github.com/dart-lang/sdk/issues/49188
[#49075]: https://github.com/dart-lang/sdk/issues/49075
2022-06-01 08:38:51 +00:00
## 2.17.3 - 2022-06-01
2022-05-30 14:50:39 +00:00
This is a patch release that fixes:
- a Dart VM compiler crash (issue [#100375][]).
2022-06-01 08:38:51 +00:00
- code completion when writing method overrides (issue [#49027][]).
- the `dart pub login` command (issue [#3424][]).
- analysis of enhanced enums (issue [#49097][]).
2022-05-30 14:50:39 +00:00
[#100375]: https://github.com/flutter/flutter/issues/100375
2022-06-01 08:38:51 +00:00
[#49027]: https://github.com/dart-lang/sdk/issues/49027
[#3424]: https://github.com/dart-lang/pub/issues/3424
[#49097]: https://github.com/dart-lang/sdk/issues/49097
2022-05-30 14:50:39 +00:00
2022-05-17 17:10:33 +00:00
## 2.17.1 - 2022-05-18
This is a patch release that fixes:
- an analyzer plugin crash (issue [#48682][]).
- Dart FFI support for `late` `Finalizable` variables (issue [#49024]).
- `dart compile` on macOS 10.15 (issue [#49010][]).
[#48682]: https://github.com/dart-lang/sdk/issues/48682
[#49024]: https://github.com/dart-lang/sdk/issues/49024
[#49010]: https://github.com/dart-lang/sdk/issues/49010
## 2.17.0 - 2022-05-11
2021-11-17 19:41:50 +00:00
2022-05-03 01:24:46 +00:00
### Language
The following features are new in the Dart 2.17 [language version][]. To use
them, you must set the lower bound on the SDK constraint for your package to
2.17 or greater (`sdk: '>=2.17.0 < 3.0.0 ' ` ) .
[language version]: https://dart.dev/guides/language/evolution
- ** [Enhanced enums with members][]**: Enum declarations can now define
members including fields, constructors, methods, getters, etc. For example:
```dart
enum Water {
frozen(32),
lukewarm(100),
boiling(212);
final int tempInFahrenheit;
const Water(this.tempInFahrenheit);
@override
String toString() => "The $name water is $tempInFahrenheit F.";
}
```
Constructors must be `const` since enum values are always constants. If the
constructor takes arguments, they are passed when the enum value is
declared.
The above enum can be used like so:
```dart
void main() {
print(Water.frozen); // prints "The frozen water is 32 F."
}
```
[enhanced enums with members]: https://github.com/dart-lang/language/blob/master/accepted/future-releases/enhanced-enums/feature-specification.md
- ** [Super parameters][]**: When extending a class whose constructor takes
parameters, the subclass constructor needs to provide arguments for them.
Often, these are passed as parameters to the subclass constructor, which
then forwards them to the superclass constructor. This is verbose because
the subclass constructor must list the name and type of each parameter in
its parameter list, and then explicitly forward each one as an argument to
the superclass constructor.
[@roy-sianez][] suggested [allowing `super.` ][super dot] before a subclass
constructor parameter to implicitly forward it to the corresponding
superclass constructor parameter. Applying this feature to Flutter
eliminated [nearly 2,000 lines of code][flutter super]. For example, before:
```dart
class CupertinoPage< T > extends Page< T > {
const CupertinoPage({
required this.child,
this.maintainState = true,
this.title,
this.fullscreenDialog = false,
LocalKey? key,
String? name,
Object? arguments,
String? restorationId,
}) : super(
key: key,
name: name,
arguments: arguments,
restorationId: restorationId,
);
// ...
}
```
And using super parameters:
```dart
class CupertinoPage< T > extends Page< T > {
const CupertinoPage({
required this.child,
this.maintainState = true,
this.title,
this.fullscreenDialog = false,
super.key,
super.name,
super.arguments,
super.restorationId,
});
// ...
}
```
From our analysis, over 90% of explicit superclass constructor calls can be
completely eliminated, using `super.` parameters instead.
[super parameters]: https://github.com/dart-lang/language/blob/master/working/1855%20-%20super%20parameters/proposal.md
[@roy-sianez]: https://github.com/roy-sianez
[super dot]: https://github.com/dart-lang/language/issues/1855
[flutter super]: https://github.com/flutter/flutter/pull/100905/files
- ** [Named args everywhere][]**: In a function call, Dart requires positional
arguments to appear before named arguments. This can be frustrating for
arguments like collection literals and function expressions that look best
as the last argument in the argument list but are positional, like the
`test()` function in the [test package][]:
```dart
main() {
test('A test description', () {
// Very long function body here...
}, skip: true);
}
```
It would be better if the `skip` argument appeared at the top of the call
to `test()` so that it wasn't easily overlooked, but since it's named and
the test body argument is positional, `skip` must be placed at the end.
Dart 2.17 removes this restriction. Named arguments can be freely
interleaved with positional arguments, allowing code like:
```dart
main() {
test(skip: true, 'A test description', () {
// Very long function body here...
});
}
```
[named args everywhere]: https://github.com/dart-lang/language/blob/master/accepted/future-releases/named-arguments-anywhere/feature-specification.md
[test package]: https://pub.dev/packages/test
2021-11-17 19:41:50 +00:00
### Core libraries
2021-11-18 21:26:56 +00:00
#### `dart:core`
2022-01-07 13:20:06 +00:00
- Add `Finalizer` and `WeakReference` which can potentially detect when
objects are "garbage collected".
2022-02-22 10:47:41 +00:00
- Add `isMimeType` method to `UriData` class, to allow case-insensitive
checking of the MIME type.
- Add `isCharset` and `isEncoding` methods to `UriData` class,
to allow case-insensitive and alternative-encoding-name aware checking
of the MIME type "charset" parameter.
- Make `UriData.fromString` and `UriData.fromBytes` recognize and omit
a "text/plain" `mimeType` even if it is not all lower-case.
2022-01-07 13:20:06 +00:00
2022-01-12 20:48:28 +00:00
#### `dart:ffi`
- Add `ref=` and `[]=` methods to the `StructPointer` and `UnionPointer`
extensions. They copy a compound instance into a native memory region.
2022-04-05 14:57:53 +00:00
- Add `AbiSpecificInteger` s for common C types:
- `char`
- `unsigned char`
- `signed char`
- `short`
- `unsigned short`
- `int`
- `unsigned int`
- `long`
- `unsigned long`
- `long long`
- `unsigned long long`
- `uintptr_t`
- `size_t`
- `wchar_t`
- Add `NativeFinalizer` which can potentially detect when objects are
"garbage collected". `NativeFinalizer` s run native code where `dart:core` 's
`Finalizer` s run Dart code on finalization.
2022-01-12 20:48:28 +00:00
2022-02-02 22:08:35 +00:00
#### `dart:html`
- Add `scrollIntoViewIfNeeded` to `Element` . Previously, this method was nested
within `scrollIntoView` based on the `ScrollAlignment` value. `scrollIntoView`
is unchanged for now, but users who intend to use the native
`Element.scrollIntoViewIfNeeded` should use the new `scrollIntoViewIfNeeded`
definition instead.
2022-03-21 18:58:38 +00:00
- Change `Performance.mark` and `Performance.measure` to accept their different
overloads. `mark` can now accept a `markOptions` map, and `measure` can now
accept a `startMark` and `endMark` , or a `measureOptions` map. Both methods
2022-03-22 19:37:00 +00:00
return their correct return types now as well - `PerformanceEntry?` and
2022-03-21 18:58:38 +00:00
`PerformanceMeasure?` , respectively.
2022-01-12 07:35:33 +00:00
#### `dart:indexed_db`
- `IdbFactory.supportsDatabaseNames` has been deprecated. It will always return
`false` .
2022-02-16 19:23:50 +00:00
#### `dart:io`
- **Breaking Change** [#47887 ](https://github.com/dart-lang/sdk/issues/47887 ):
`HttpClient` has a new `connectionFactory` property, which allows socket
creation to be customized. Classes that `implement HttpClient` may be broken
by this change. Add the following method to your classes to fix them:
```dart
void set connectionFactory(
Future< ConnectionTask < Socket > > Function(
Uri url, String? proxyHost, int? proxyPort)?
f) =>
throw UnsupportedError("connectionFactory not implemented");
```
2022-02-17 21:39:31 +00:00
- **Breaking Change** [#48093 ](https://github.com/dart-lang/sdk/issues/48093 ):
`HttpClient` has a new `keyLog` property, which allows TLS keys to be logged
for debugging purposes. Classes that `implement HttpClient` may be broken by
this change. Add the following method to your classes to fix them:
```dart
void set keyLog(Function(String line)? callback) =>
throw UnsupportedError("keyLog not implemented");
```
2022-03-17 23:00:57 +00:00
- **Breaking Change** [#34218 ](https://github.com/dart-lang/sdk/issues/34218 ):
Constants in `dart:io` following the `SCREAMING_CAPS` convention have been
removed (they were previously deprecated). Please use the corresponding
`lowerCamelCase` constants instead.
2022-08-30 19:16:28 +00:00
- **Breaking Change** [#48513 ](https://github.com/dart-lang/sdk/issues/48513 ):
2023-01-19 10:06:29 +00:00
Add a new `allowLegacyUnsafeRenegotiation` property to `SecurityContext` ,
2022-08-30 19:16:28 +00:00
which allows TLS renegotiation for client secure sockets.
2022-02-17 21:39:31 +00:00
- Add a optional `keyLog` parameter to `SecureSocket.connect` and
`SecureSocket.startConnect` .
2022-03-02 19:50:50 +00:00
- Deprecate `SecureSocket.renegotiate` and `RawSecureSocket.renegotiate` ,
which were no-ops.
2022-01-21 16:42:40 +00:00
### Tools
#### Dart command line
2022-02-09 13:41:52 +00:00
- **Breaking change** [#46100 ](https://github.com/dart-lang/sdk/issues/46100 ):
2022-01-21 16:42:40 +00:00
The standalone `dart2js` tool has been
marked deprecated as previously announced.
Its replacement is the `dart compile js` command.
Should you find any issues, or missing features, in the replacement
2022-01-27 21:13:41 +00:00
command, kindly file [an issue ](https://github.com/dart-lang/sdk/issues/new ).
2022-01-21 16:42:40 +00:00
2022-02-09 13:41:52 +00:00
- **Breaking change** [#46100 ](https://github.com/dart-lang/sdk/issues/46100 ):
2022-01-27 21:13:41 +00:00
The standalone `dartdevc` tool has been marked deprecated as previously
2023-01-24 18:00:25 +00:00
announced and will be deleted in a future Dart stable release. This tool
2022-01-27 21:13:41 +00:00
was intended for use only by build systems like bazel, `build_web_compilers`
and `flutter_tools` . The functionality remains available for those systems,
but it is no longer exposed as a command-line tool in the SDK.
2022-02-07 09:55:04 +00:00
Please share any concerns in the
2022-01-27 21:13:41 +00:00
[breaking change tracking issue ](https://github.com/dart-lang/sdk/issues/46100 ).
2022-01-21 16:42:40 +00:00
2022-02-09 13:41:52 +00:00
- **Breaking change** [#46100 ](https://github.com/dart-lang/sdk/issues/46100 ):
2022-01-27 08:12:00 +00:00
The standalone `dartdoc` tool has been removed as
previously announced. Its replacement is the `dart doc` command.
2022-02-28 16:02:54 +00:00
- The template names used in the `dart create` command have been simplified,
and the current template names are now the set shown below. (Note: for
backwards compatibility the former template names can still be used.)
```
[console] (default) A command-line application.
[package] A package containing shared Dart libraries.
[server-shelf] A server app using package:shelf.
[web] A web app that uses only core Dart libraries.
```
2022-08-30 14:14:18 +00:00
#### Analyzer
- added quick fixes for diagnostics:
[`always_use_package_imports` ](https://dart-lang.github.io/linter/lints/always_use_package_imports.html ),
[`avoid_void_async` ](https://dart-lang.github.io/linter/lints/avoid_void_async.html ),
[`cascade_invocations` ](https://dart-lang.github.io/linter/lints/cascade_invocations.html ),
`default_list_constructor` ,
[`must_call_super` ](https://dart.dev/tools/diagnostic-messages#must_call_super ),
[`no_leading_underscores_for_local_identifiers` ](https://dart-lang.github.io/linter/lints/no_leading_underscores_for_local_identifiers.html ),
[`null_check_on_nullable_type_parameter` ](https://dart-lang.github.io/linter/lints/null_check_on_nullable_type_parameter.html ),
[`prefer_function_declarations_over_variables` ](https://dart-lang.github.io/linter/lints/prefer_function_declarations_over_variables.html ),
[`sort_constructors_first` ](https://dart-lang.github.io/linter/lints/sort_constructors_first.html ),
[`sort_unnamed_constructors_first` ](https://dart-lang.github.io/linter/lints/sort_unnamed_constructors_first.html ),
`undefined_enum_constant` ,
[`unnecessary_late` ](https://dart-lang.github.io/linter/lints/unnecessary_late.html ),
`unnecessary_null_aware_assignments` ,
[`use_enums` ](https://dart-lang.github.io/linter/lints/use_enums.html ),
[`use_raw_strings` ](https://dart-lang.github.io/linter/lints/use_raw_strings.html ),
[`use_super_parameters` ](https://dart-lang.github.io/linter/lints/use_super_parameters.html ),
`var_return_type`
- added many errors for invalid enhanced enums
- added new Hint: [`unnecessary_final` ](https://dart.dev/tools/diagnostic-messages#unnecessary_final )
- added new FFI error: `compound_implements_finalizable`
- improved errors for invalid Unicode escapes in source code
2022-03-14 15:56:38 +00:00
#### Linter
2022-05-11 18:46:44 +00:00
Updated the Linter to `1.22.0` , which includes changes that
2022-05-06 16:08:50 +00:00
- fixes null-safe variance exceptions in `invariant_booleans` .
2022-03-22 08:54:56 +00:00
- updates `depend_on_referenced_packages` to treat `flutter_gen` as a virtual
package, not needing an explicit dependency.
- updates `unnecessary_null_checks` and
2022-03-18 19:56:21 +00:00
`null_check_on_nullable_type_parameter` to handle
list/set/map literals, and `yield` and `await` expressions.
2022-03-15 17:09:22 +00:00
- fixes `unnecessary_null_aware_assignments` property-access
false positives.
- adds new lint: `use_super_parameters` .
2022-03-14 15:56:38 +00:00
- adds new lint: `use_enums` .
- adds new lint: `use_colored_box` .
- improves performance for `sort_constructors` .
- improves docs for `always_use_package_imports` ,
`avoid_print` , and `avoid_relative_lib_imports` .
- updates `avoid_void_async` to skip `main` functions.
- updates `prefer_final_parameters` to not super on super params.
- updates lints for enhanced-enums and super-initializer language
features.
- updates `unnecessary_late` to report on variable names.
- marks `null_check_on_nullable_type_parameter` stable.
2022-03-29 17:10:49 +00:00
#### Dartdoc
Updated dartdoc to 5.1.0, which includes changes that
- support the enhanced enums feature
- remove superfluous `[...]` links
- fix `categoryOrder` option
- display categorized extensions
- add annotations to extensions
- make minor improvements to performance
2022-03-22 08:54:56 +00:00
## 2.16.2 - 2022-03-24
This is a patch release that fixes a dart2js crash when building some Flutter
web apps (issue [#47916][]).
[#47916]: https://github.com/dart-lang/sdk/issues/47916
2022-02-08 10:18:48 +00:00
## 2.16.1 - 2022-02-09
This is a patch release that fixes an AOT precompiler crash when building some
Flutter apps (issue [flutter/flutter#97301][]).
[flutter/flutter#97301]: https://github.com/flutter/flutter/issues/97301
2022-02-07 09:55:04 +00:00
## 2.16.0 - 2022-02-03
2022-01-07 13:20:06 +00:00
### Core libraries
#### `dart:core`
2021-11-17 19:41:50 +00:00
2021-11-11 09:42:21 +00:00
- Add `Error.throwWithStackTrace` which can `throw` an
error with an existing stack trace, instead of creating
a new stack trace.
2022-04-05 14:57:53 +00:00
#### `dart:ffi`
- Add `Abi` and `AbiSpecificInteger` . These enable specifying integers which
have different sizes/signs per ABI (hardware and OS combination).
2021-12-07 14:44:49 +00:00
#### `dart:io`
2022-02-09 13:41:52 +00:00
- **Security advisory**
[CVE-2022-0451 ](https://github.com/dart-lang/sdk/security/advisories/GHSA-c8mh-jj22-xg5h ),
**breaking change** [#45410 ](https://github.com/dart-lang/sdk/issues/45410 ):
2022-02-01 19:48:13 +00:00
`HttpClient` no longer transmits some headers (i.e. `authorization` ,
`www-authenticate` , `cookie` , `cookie2` ) when processing redirects to a
different domain.
2022-02-09 13:41:52 +00:00
- **Breaking change** [#47653 ](https://github.com/dart-lang/sdk/issues/47653 ):
2022-02-01 19:48:13 +00:00
On Windows, `Directory.rename` will no longer delete a directory if
`newPath` specifies one. Instead, a `FileSystemException` will be thrown.
2022-02-09 13:41:52 +00:00
- **Breaking change** [#47769 ](https://github.com/dart-lang/sdk/issues/47769 ):
2022-02-01 19:48:13 +00:00
The `Platform.packageRoot` API has been removed. It had been marked deprecated
in 2018, as it doesn't work with any Dart 2.x release.
2021-12-08 18:33:00 +00:00
- Add optional `sourcePort` parameter to `Socket.connect` , `Socket.startConnect` , `RawSocket.connect` and `RawSocket.startConnect`
2021-12-07 14:44:49 +00:00
#### `dart:isolate`
2022-02-09 13:41:52 +00:00
- **Breaking change** [#47769 ](https://github.com/dart-lang/sdk/issues/47769 ):
2021-12-07 17:13:49 +00:00
The `Isolate.packageRoot` API has been removed. It had been marked deprecated
in 2018, as it doesn't work with any Dart 2.x release.
2021-12-07 14:44:49 +00:00
2021-11-09 13:23:42 +00:00
### Tools
#### Dart command line
2022-02-09 13:41:52 +00:00
- **Breaking change** [#46100 ](https://github.com/dart-lang/sdk/issues/46100 ):
2021-11-17 19:41:50 +00:00
The standalone `dartanalyzer` tool has been
2021-11-09 13:23:42 +00:00
marked deprecated as previously announced.
Its replacement is the `dart analyze` command.
Should you find any issues, or missing features, in the replacement
2021-11-24 18:34:02 +00:00
command, kindly file [an issue][].
2021-11-09 13:23:42 +00:00
[an issue]: https://github.com/dart-lang/sdk/issues/new
2022-02-09 13:41:52 +00:00
- **Breaking change** [#46100 ](https://github.com/dart-lang/sdk/issues/46100 ):
2021-12-06 15:47:17 +00:00
The standalone `dartdoc` tool has been
marked deprecated as previously announced.
Its replacement is the `dart doc` command.
Should you find any issues, or missing features, in the replacement
command, kindly file [an issue][].
[an issue]: https://github.com/dart-lang/sdk/issues/new
2022-03-07 12:16:28 +00:00
- **Breaking Change** [#46100 ](https://github.com/dart-lang/sdk/issues/46100 ):
The deprecated standalone `pub` tool has been removed.
Its replacement is the `dart pub` command.
Should you find any issues, or missing features, in the replacement
command, kindly file [an issue][].
[an issue]: https://github.com/dart-lang/pub/issues/new
2022-01-27 11:17:00 +00:00
#### Pub
- Fixed race conditions in `dart pub get` , `dart run` and `dart pub global run` .
It should now be safe to run these concurrently.
- If (when) Pub crashes it will save a verbose log in
`$PUB_CACHE/log/pub_log.txt` This can be used for filing issues to the issue
tracker.
`dart --verbose pub [command]` will also cause the log file to be written.
2022-03-30 09:34:50 +00:00
- `dart pub global activate --source=git` now takes arguments `--git-path` to
specify the path of the activated package in the pubspec and `--git-ref` to
specify the branch or revision to check out.
2022-01-27 11:17:00 +00:00
- `dart pub add` can now add multiple packages in one command.
2022-03-30 09:34:50 +00:00
- `dart pub token add` can now add a token for [pub.dev ](https://pub.dev ).
- `dart pub uploader` has been removed. To manage uploaders for a package use
the `https://pub.dev/<packagename>/admin` web-interface.
- Pub now supports a separate `pubspec_overrides.yaml` file that can contain
`dependency_overrides` . This makes it easier to avoid checking the local
overrides into version control.
2022-05-03 01:24:46 +00:00
2021-11-24 17:05:12 +00:00
#### Linter
2022-03-14 15:56:38 +00:00
Updated the Linter to `1.18.0` , which includes changes that
2022-03-08 23:34:54 +00:00
2022-01-11 16:44:55 +00:00
- extends `camel_case_types` to cover enums.
2022-02-07 09:55:04 +00:00
- fixes `no_leading_underscores_for_local_identifiers` to not
2022-01-11 16:44:55 +00:00
mis-flag field formal parameters with default values.
- fixes `prefer_function_declarations_over_variables` to not
mis-flag non-final fields.
- improves performance for `prefer_contains` .
- updates `exhaustive_cases` to skip deprecated values that
redirect to other values.
2021-12-16 22:19:59 +00:00
- adds new lint: `unnecessary_late` .
2021-12-09 20:42:29 +00:00
- improves docs for `prefer_initializing_formals` .
- updates `secure_pubspec_urls` to check `issue_tracker` and
`repository` entries.
- adds new lint: `conditional_uri_does_not_exist` .
- improves performance for
`missing_whitespace_between_adjacent_strings` .
2021-12-08 14:24:01 +00:00
- adds new lint: `avoid_final_parameters` .
2021-11-24 17:05:12 +00:00
- adds new lint: `no_leading_underscores_for_library_prefixes` .
- adds new lint: `no_leading_underscores_for_local_identifiers` .
- adds new lint: `secure_pubspec_urls` .
- adds new lint: `sized_box_shrink_expand` .
2021-12-08 14:24:01 +00:00
- adds new lint: `use_decorated_box` .
2021-11-24 17:05:12 +00:00
- improves docs for `omit_local_variable_types` .
2021-12-14 12:00:35 +00:00
## 2.15.1 - 2021-12-14
This is a patch release that fixes:
- an AOT compilation failure in some Flutter apps (issue [#47878][]).
- `dart pub publish` for servers with a path in the URL (pr
[dart-lang/pub#3244][]).
[#47878]: https://github.com/dart-lang/sdk/issues/47878
[dart-lang/pub#3244]: https://github.com/dart-lang/pub/pull/3244
2021-12-13 10:46:26 +00:00
## 2.15.0 - 2021-12-08
2021-08-17 15:17:02 +00:00
2022-02-09 13:41:52 +00:00
- **Security advisory**
[CVE-2021-22567 ](https://github.com/dart-lang/sdk/security/advisories/GHSA-8pcp-6qc9-rqmv ):
Bidirectional Unicode text can be interpreted and compiled differently than
how it appears in editors and code-review tools. Exploiting this an attacker
could embed source that is invisible to a code reviewer but that modifies the
behavior of a program in unexpected ways. Dart 2.15.0 introduces new analysis
warnings that flags the use of these.
- **Security advisory**
[CVE-2021-22568 ](https://github.com/dart-lang/sdk/security/advisories/GHSA-r32f-vhjp-qhj7 ):
A malicious third-party package repository may impersonate a user on pub.dev
for up to one hour after the user has published a package to that third-party
package repository using `dart pub publish` . As of Dart SDK version 2.15.0
requests to third-party package repositories will no longer include an OAuth2
`access_token` intended for pub.dev.
2021-08-17 15:17:02 +00:00
### Language
2021-11-05 18:48:27 +00:00
The following features are new in the Dart 2.15 [language version][]. To use
2021-11-04 19:17:54 +00:00
them, you must set the lower bound on the SDK constraint for your package to
2021-11-05 18:48:27 +00:00
2.15 or greater (`sdk: '>=2.15.0 < 3.0.0 ' ` ) .
2021-09-24 18:34:20 +00:00
2021-11-04 19:17:54 +00:00
[language version]: https://dart.dev/guides/language/evolution
- **[Constructor tear-offs][]**: Previous Dart versions allowed a method on an
instance to be passed as a closure, and similarly for static methods. This is
commonly referred to as "closurizing" or "tearing off" a method. Constructors
were not previously eligible for closurization, forcing users to explicitly
2021-12-08 14:24:01 +00:00
write wrapper functions when using constructors as first class functions.
See the calls to `map()` in this example:
2021-09-24 18:34:20 +00:00
```dart
class A {
int x;
A(this.x);
A.fromString(String s) : x = int.parse(s);
}
void main() {
var listOfInts = [1, 2, 3];
var listOfStrings = ["1", "2", "3"];
for(var a in listOfInts.map((x) => A(x))) {
print(a.x);
}
for(var a in listOfStrings.map((x) => A.fromString(x))) {
print(a.x);
}
}
```
New in Dart 2.15, constructors are now allowed to be torn off. Named
2021-12-08 14:24:01 +00:00
constructors are closurized using their declared name (here `A.fromString` ).
To closurize unnamed constructors, use the keyword `new` (here `A.new` ).
The above example may now be written as:
2021-09-24 18:34:20 +00:00
```dart
class A {
int x;
A(this.x);
A.fromString(String s) : x = int.parse(s);
}
void main() {
var listOfInts = [1, 2, 3];
var listOfStrings = ["1", "2", "3"];
for(A a in listOfInts.map(A.new)) {
print(a.x);
}
for(A a in listOfStrings.map(A.fromString)) {
print(a.x);
}
}
```
Constructors for generic classes may be torn off as generic functions, or
2021-12-08 14:24:01 +00:00
instantiated at the tear-off site. In the following example, the tear-off
`G.new` is used to initialize the variable `f` produces a generic function
which may be used to produce an instance of `G<T>` for any type `T` provided
when `f` is called. The tear-off `G<String>.new` is used to initialize the
variable `g` to produce a non-generic function which may only be used
2021-09-24 18:34:20 +00:00
to produce instances of type `G<String>` .
```dart
class G< T > {
T x;
G(this.x);
}
void main() {
G< T > Function< T > (T x) f = G.new;
var x = f< int > (3);
G< String > Function(String y) g = G< String > .new;
var y = g("hello");
}
```
2021-12-08 14:24:01 +00:00
[constructor tear-offs]: https://github.com/dart-lang/language/blob/master/accepted/2.15/constructor-tearoffs/feature-specification.md
2021-09-24 18:34:20 +00:00
2021-11-04 19:17:54 +00:00
- **[Generic type literals][explicit instantiation]**: Previous Dart versions
allowed class names to be used as type literals. So for example,`int` may be
used as an expression, producing a value of type `Type` . Generic classes (e.g.
`List` ) could be referred to by name as an expression, but no type arguments
could be provided and so only the `dynamic` instantiation could be produced
directly as an expression without using indirect methods:
2021-09-24 18:34:20 +00:00
```dart
// Workaround to capture generic type literals.
Type typeOf< T > () => T;
void main() {
var x = int; // The Type literal corresponding to `int` .
var y = List; // The Type literal corresponding to `List<dynamic>` .
// Use workaround to capture generic type literal.
var z = typeOf< List < int > >(); // The Type literal for `List<int>` .
}
```
New in Dart 2.15, instantiations of generic classes may now be used as Type
literals:
```dart
void main() {
var x = int; // The Type literal corresponding to `int` .
var y = List; // The Type literal corresponding to `List<dynamic>` .
var z = List< int > ; // The Type literal corresponding to `List<int>` .
}
```
2021-11-04 19:17:54 +00:00
- **[Explicit generic method instantiations][explicit instantiation]**: Previous
Dart versions allowed generic methods to be implicitly specialized (or
"instantiated") to non-generic versions when assigned to a location with a
2021-09-24 18:34:20 +00:00
compatible monomorphic type. Example:
```dart
// The generic identity function.
T id< T > (T x) => x;
void main() {
// Initialize `intId` with a version of `id` implicitly specialized to
// `int` .
int Function(int) intId = id;
print(intId(3));
// Initialize `stringId` with a version of `id` implicitly specialized to
// `String` .
String Function(String) stringId = id;
print(stringId("hello"));
}
```
New in Dart 2.15, generic methods may be explicitly instantiated using the
syntax `f<T>` where `f` is the generic method to specialize and `T` is the
type argument (in general, type arguments) to be used to specialize the
method. Example:
```dart
// The generic identity function.
T id< T > (T x) => x;
void main() {
// Initialize `intId` with a version of `id` explicitly specialized to
// `int` .
var intId = id< int > ;
print(intId(3));
// Initialize `stringId` with a version of `id` explicitly specialized to
// `String` .
var stringId = id< String > ;
print(stringId("hello"));
}
```
2021-12-08 14:24:01 +00:00
[explicit instantiation]: https://github.com/dart-lang/language/blob/master/accepted/2.15/constructor-tearoffs/feature-specification.md#explicitly-instantiated-classes-and-functions
2021-10-14 09:23:52 +00:00
2021-11-04 19:17:54 +00:00
- **[Generic instantiation of function objects][object instantiation]**: Generic
function instantiation was previously restricted to function declarations. For
2021-12-08 14:24:01 +00:00
example, as soon as a function had been torn off, it could not be
2021-11-04 19:17:54 +00:00
instantiated:
2021-10-14 09:23:52 +00:00
```dart
2021-12-08 14:24:01 +00:00
// Before Dart 2.15:
2021-10-14 09:23:52 +00:00
X id< X > (X x) => x;
void main() {
var fo = id; // Tear off `id` , creating a function object.
var c1 = fo< int > ; // Compile-time error: can't instantiate `fo` .
int Function(int) c2 = fo; // Same compile-time error.
// Constants are treated the same.
}
```
2021-12-08 14:24:01 +00:00
New in Dart 2.15, this restriction has been lifted. It is now possible
2021-10-14 09:23:52 +00:00
to obtain a generic instantiation of an existing function object, both
explicitly and implicitly (again, this works the same for non-constants):
```dart
X id< X > (X x) => x;
X other< X > (X x) => throw x;
void main() {
const fo = id; // Tear off `id` , creating a function object.
// Generic function instantiation on `fo` is no longer an error.
const c1 = fo< int > ; // OK.
const int Function(int) c2 = fo; // OK.
// This also generalizes function instantiation because we can,
// e.g., use non-trivial expressions and go via a constructor.
const c3 = A(true); // OK.
}
class A {
final int Function(int) x;
// `(...)<T>` is now allowed, also in a `const` constructor.
const A(bool b): x = (b ? id : other)< int > ;
}
```
[Object instantiation]: https://github.com/dart-lang/language/pull/1812
2021-08-17 15:17:02 +00:00
- Annotations on type parameters of classes can no longer refer to class members
without a prefix. For example, this used to be permitted:
```dart
class C< @Annotation(foo) T> {
static void foo() {}
}
```
Now, the reference must be qualified with the class name, i.e.:
```dart
class C< @Annotation(C.foo) T> {
static void foo() {}
}
```
This brings the implementation behavior in line with the spec.
2021-08-27 15:01:15 +00:00
- Initializer expressions on implicitly typed condition variables can now
contribute to type promotion. For example, this program no longer produces a
compile-time error:
```dart
f(int? i) {
var iIsNull = i == null;
if (!iIsNull) {
2021-11-04 19:17:54 +00:00
print(i + 1); // OK, because `i` is known to be non-null.
2021-08-27 15:01:15 +00:00
}
2021-10-14 09:23:52 +00:00
}
2021-08-27 15:01:15 +00:00
```
2021-12-08 14:24:01 +00:00
Previously, the above program had a compile-time error due to a bug
([#1785][]) in type promotion which prevented the initializer expression
(`i == null`) from being accounted for when the variable in question
(`iIsNull`) lacked an explicit type.
2021-08-27 15:01:15 +00:00
To avoid causing problems for packages that are intended to work with older
2021-12-08 14:24:01 +00:00
versions of Dart, the fix only takes effect when the minimum SDK of the source
packages is 2.15 or greater.
2021-08-27 15:01:15 +00:00
[#1785]: https://github.com/dart-lang/language/issues/1785
2021-08-31 15:09:40 +00:00
- Restrictions on members of a class with a constant constructor are relaxed
such that they only apply when the class has a _generative_ constant
2021-12-08 14:24:01 +00:00
constructor. For example, this used to be an error, but is now permitted:
2021-08-31 15:09:40 +00:00
```dart
abstract class A {
2021-12-08 14:24:01 +00:00
const factory A() = B;
2021-08-31 15:09:40 +00:00
var v1;
late final v2 = Random().nextInt(10);
late final v3;
}
class B implements A {
2021-12-08 14:24:01 +00:00
const B([this.v3 = 1]);
2021-08-31 15:09:40 +00:00
get v1 => null;
set v1(_) => throw 'Cannot mutate B.v1';
final v2 = 0;
final v3;
set v3(_) => throw 'Cannot initialize B.v3';
}
```
This implements a relaxation of the specified rule for a `late final`
instance variable, and it brings the implementation behavior in line with
the specification in all other cases.
2021-11-04 19:17:54 +00:00
- **Function object canonicalization and equality**: Several corner cases in the
area of function object canonicalization and function object equality have
been updated, such that all tools behave in the same way, and the behavior
matches the specification.
2021-10-14 09:23:52 +00:00
In particular, function objects are now equal when they are obtained by
generic instantiation from the same function with the same actual type
arguments, even when that type argument is not known at compile time.
2021-12-08 14:24:01 +00:00
When the expressions are constant then the function objects are identical.
2021-10-14 09:23:52 +00:00
Constant expressions are treated as such even when they do not occur in a
2021-11-04 19:17:54 +00:00
constant context (e.g., `var f = top;` ).
2021-10-14 09:23:52 +00:00
2021-09-06 12:26:11 +00:00
### Core libraries
2021-09-27 11:58:16 +00:00
#### `dart:async`
- Make the `unawaited` function's argument nullable, to allow calls like
2021-12-08 14:24:01 +00:00
`unawaited(foo?.bar())` .
2021-09-27 11:58:16 +00:00
2021-09-06 12:26:11 +00:00
#### `dart:cli`
- The experimental `waitFor` functionality, and the library containing only that
function, are now deprecated.
2021-10-05 13:25:30 +00:00
#### `dart:core`
2021-09-09 12:02:15 +00:00
2021-09-22 14:20:16 +00:00
- Add extension `name` getter on enum values.
2021-09-09 12:02:15 +00:00
- Add `Enum.compareByIndex` helper function for comparing enum values by index.
2021-09-22 14:20:16 +00:00
- Add `Enum.compareByName` helper function for comparing enum values by name.
- Add extension methods on `Iterable<T extends Enum>` , intended for
`SomeEnumType.values` lists, to look up values by name.
2021-10-19 16:07:52 +00:00
- Deprecate `IntegerDivisionByZeroException` .
Makes the class also implement `Error` . Code throwing the exception will be
migrated to throwing an `Error` instead until the class is unused and
ready to be removed.
Code catching the class should move to catching `Error` instead
(or, for integers, check first for whether it's dividing by zero).
2021-09-09 12:02:15 +00:00
2022-04-05 14:57:53 +00:00
#### `dart:ffi`
- Add `Bool` native type.
2021-10-05 13:25:30 +00:00
#### `dart:io`
2022-02-09 13:41:52 +00:00
- **Breaking change** [#46875 ](https://github.com/dart-lang/sdk/issues/46875 ):
2021-10-05 13:25:30 +00:00
The `SecurityContext` class in `dart:io` has been updated to set the minimum
TLS protocol version to TLS1_2_VERSION (1.2) instead of TLS1_VERSION.
2021-10-13 18:24:26 +00:00
- Add `RawSocket.sendMessage` , `RawSocket.receiveMessage` that allow passing of
file handle references via Unix domain sockets.
2021-10-05 13:25:30 +00:00
2021-10-18 18:41:53 +00:00
#### `dart:js_util`
2021-11-09 00:33:12 +00:00
- The `js_util` methods `setProperty` , `callMethod` , and `callConstructor` have
been optimized to remove checks on arguments when the checks can be elided.
Also, those methods, along with `getProperty` and `newObject` , now support a
generic type argument to specify a return type. These two changes make simple
`js_util` usage, like reading and writing primitive properties or calling
methods with simple arguments, have zero overhead.
2021-10-18 18:41:53 +00:00
2021-10-19 01:00:08 +00:00
#### `dart:web_sql`
2022-02-09 13:41:52 +00:00
- **Breaking change** [#46316 ](https://github.com/dart-lang/sdk/issues/46316 ):
2021-10-19 01:00:08 +00:00
The WebSQL standard was abandoned more than 10
years ago and is not supported by many browsers. This release completely
deletes the `dart:web_sql` library.
#### `dart:html`
2022-02-09 13:41:52 +00:00
- **Breaking change** [#46316 ](https://github.com/dart-lang/sdk/issues/46316 ):
2021-12-08 14:24:01 +00:00
Related to the removal of `dart:web_sql` (see above), `window.openDatabase`
has been removed.
2021-10-19 01:00:08 +00:00
2021-08-23 20:54:22 +00:00
### Tools
#### Dart command line
2022-02-09 13:41:52 +00:00
- **Breaking change** [#46100][]: The standalone `dart2native` tool has been
2021-08-23 20:54:22 +00:00
removed as previously announced. Its replacements are the
`dart compile exe` and `dart compile aot-snapshot` commands, which offer the
same functionality.
2022-02-09 13:41:52 +00:00
- **Breaking change**: The standalone `dartfmt` tool has been removed as
2021-10-04 18:40:57 +00:00
previously announced. Its replacement is the `dart format` command.
Note that `dart format` has [a different set of options and
defaults][dartfmt cli] than `dartfmt` .
2021-12-08 14:24:01 +00:00
- When a script is `dart run` it will always be precompiled, but with
incremental precompilation for following runs.
2021-09-02 14:14:35 +00:00
#### Dart VM
2022-02-09 13:41:52 +00:00
- **Breaking change** [#45451 ](https://github.com/dart-lang/sdk/issues/45451 ):
2021-09-06 16:46:53 +00:00
Support for `dart-ext:` -style native extensions has been removed as previously
announced. Use `dart:ffi` to bind to native libraries instead.
2021-09-02 14:14:35 +00:00
2022-02-09 13:41:52 +00:00
- **Breaking change** [#46754 ](https://github.com/dart-lang/sdk/issues/46754 ):
2021-09-22 08:39:35 +00:00
Isolates spawned via the `Isolate.spawn()` API are now grouped, operate on the
same managed heap and can therefore share various VM-internal data structures.
This leads to ~100x faster isolate startup latency, ~10-100x lower
per-isolate base memory overhead and ~8x faster inter-isolate communication.
Making isolates operate on the same heap will also make them collaborate on
garbage collections, which changes performance characteristics for GC-heavy
applications that may - in rare cases - negatively affect pause times or
throughput.
- Allow closures both in inter-isolate messages as well as as entrypoints in
`Isolate.spawn(<entrypoint>, ...)` calls. Closures and their enclosing context
may need to be copied in this process. The enclosing context is - as with
normal messages - verified to only contain objects that are sendable.
Note of caution: The Dart VM's current representation of enclosing variables
in closures can make closures hang on to more variables than strictly needed.
Using such closures in inter-isolate communication can therefore lead to
copying of larger transitive object graphs. If the extended transitive
closure includes objects that are illegal to send, the sending will fail.
See [#36983 ](https://github.com/dart-lang/sdk/issues/36983 ), which tracks this
existing memory leak issue.
2021-09-07 17:14:33 +00:00
#### Linter
2021-11-24 17:05:12 +00:00
Updated the Linter to `1.14.0` , which includes changes that
2021-12-08 14:24:01 +00:00
- improves performance for `annotate_overrides` , `prefer_contains` , and
`prefer_void_to_null` .
- marks `avoid_dynamic_calls` stable.
- fixed `avoid_null_checks_in_equality_operators` false positive with
non-nullable params.
2021-09-20 18:32:11 +00:00
- update `avoid_print` to allow `kDebugMode` -wrapped print calls.
2021-09-22 14:20:16 +00:00
- adds support for constructor tear-offs to `avoid_redundant_argument_values` ,
2021-09-07 23:43:54 +00:00
`unnecessary_lambdas` , and `unnecessary_parenthesis` .
2021-12-08 14:24:01 +00:00
- improves messages for `avoid_renaming_method_parameters` .
2021-09-07 17:14:33 +00:00
- improves regular expression parsing performance for common checks
(`camel_case_types`, `file_names` , etc.).
2021-12-08 14:24:01 +00:00
- fixed `file_names` to report at the start of the file
(not the entire compilation unit).
- allow `while (true) { ... }` in `literal_only_boolean_expressions` .
- fixed `omit_local_variable_types` false positives.
- fixed `omit_local_variable_types` to not flag a local type that is required
for inference.
- fixed `overridden_fields` false positive with static fields.
- fixed `prefer_collection_literals` named typed parameter false positives.
- fixed `prefer_const_constructors` false positive for deferred imports.
- fixed `prefer_final_parameters` handling of initializing formals.
- fixed `prefer_generic_function_type_aliases` false positives with incomplete
2021-09-07 17:14:33 +00:00
statements.
2021-12-08 14:24:01 +00:00
- fixed `prefer_initializing_formals` false positives with factory constructors.
- fixed `prefer_void_to_null` false positive with overridden properties.
- fixed `prefer_void_to_null` false positives on overriding returns.
- fixed `prefer_void_to_null` false positives.
- adds a new lint: `unnecessary_constructor_name` to flag unnecessary uses of
`.new` .
2021-09-07 17:14:33 +00:00
- updates `unnecessary_getters_setters` to only flag the getter.
2021-12-08 14:24:01 +00:00
- fixed `unnecessary_parenthesis` false positive with function expressions.
- fixed `use_build_context_synchronously` false positive in awaits inside
anonymous functions.
- improve control flow analysis for `use_build_context_synchronously` .
- fixed `use_rethrow_when_possible` false positives.
- fixed `void_checks` false positives with incomplete source.
2021-09-14 16:05:00 +00:00
2021-09-13 11:02:19 +00:00
### Pub
2021-09-14 16:05:00 +00:00
2021-10-29 13:05:39 +00:00
- If you have analytics enabled `dart pub get` will send
[usage metrics ](https://github.com/dart-lang/pub/blob/0035a40f25d027130c0314571da53ffafc6d973b/lib/src/solver/result.dart#L131-L175 )
for packages from pub.dev, intended for popularity analysis.
- Adds support for token-based authorization to third-party package-repositories
2021-09-14 16:05:00 +00:00
with the new command `dart pub token` .
- Credentials are no longer stored in the pub-cache, but in a platform dependent
config directory:
* On Linux `$XDG_CONFIG_HOME/dart/pub-credentials.json` if `$XDG_CONFIG_HOME`
is defined, otherwise `$HOME/.config/dart/pub-credentials.json`
* On Mac OS: `$HOME/Library/Application Support/dart/pub-credentials.json`
* On Windows: `%APPDATA%/dart/pub-credentials.json`
2021-10-29 13:05:39 +00:00
- The syntax for dependencies hosted at a third-party package repository has
been simplified. Before you would need to write:
2021-12-08 14:24:01 +00:00
```yaml
2021-10-29 13:05:39 +00:00
dependencies:
colorizer:
hosted:
name: colorizer
url: 'https://custom-pub-server.com'
version: ^1.2.3
environment:
sdk: '>=2.14.0 < 3.0.0 '
```
Now you can write:
2021-12-08 14:24:01 +00:00
```yaml
2021-10-29 13:05:39 +00:00
dependencies:
colorizer:
hosted: 'https://custom-pub-server.com'
version: ^1.2.3
environment:
sdk: '>=2.15.0 < 3.0.0 '
```
This feature requires
[language-version ](https://dart.dev/guides/language/evolution#language-versioning )
2.15 or later, e.g. the `pubspec.yaml` should have an SDK constraint of
`>=2.15 <3.0.0` .
2021-09-14 16:05:00 +00:00
2021-09-13 11:02:19 +00:00
- Detect potential leaks in `dart pub publish` .
When publishing, pub will examine your files for potential secret keys, and
warn you.
To ignore a file that has a false positive, add it to a
[`false_secrets` ](https://dart.dev/go/false-secrets ) section of your
`pubspec.yaml` .
2021-09-14 16:05:00 +00:00
- Fixes unicode terminal detection windows.
2021-09-22 14:20:16 +00:00
- New flag `--example` to the commands
2021-09-14 16:05:00 +00:00
`dart pub get/upgrade/downgrade/add/remove` that will result in the `example/`
2021-09-22 14:20:16 +00:00
folder dependencies to be updated after operating in the current directory.
2021-09-07 17:14:33 +00:00
2021-11-09 00:33:12 +00:00
### Other libraries
#### `package:js`
- Extensions on JS interop or native `dart:html` classes can now declare
members as `external` . These members are equivalent to regular extension
members that use `js_util` to expose the underlying JavaScript.
2021-10-13 09:02:30 +00:00
## 2.14.4 - 2021-10-14
This is a patch release that fixes:
- a memory leak of analyzer plugins (issue [flutter/flutter#90868][]).
- the Dart VM sometimes loading expired certificates on Windows (issues
[#46370][] and [#47420][]).
[flutter/flutter#90868]: https://github.com/flutter/flutter/issues/90868
[#46370]: https://github.com/dart-lang/sdk/issues/46370
[#47420]: https://github.com/dart-lang/sdk/issues/47420
2021-09-29 10:54:42 +00:00
## 2.14.3 - 2021-09-30
This is a patch release that fixes:
2021-10-13 09:02:30 +00:00
- a code completion performance regression (issue
[flutter/flutter-intellij#5761][]).
- debug information emitted by the Dart VM (issue [#47289][]).
2021-09-29 10:54:42 +00:00
[flutter/flutter-intellij#5761]:
https://github.com/flutter/flutter-intellij/issues/5761
[#47289]: https://github.com/dart-lang/sdk/issues/47289
2021-09-15 09:57:04 +00:00
## 2.14.2 - 2021-09-16
This is a patch release that fixes:
- two dartdoc crashes (issues [dart-lang/dartdoc#2740][] and
[dart-lang/dartdoc#2755][]).
- error messages when using the `>>>` operator on older language versions
(issue [#46886][]).
- invalid `pubspec.lock` paths on Windows (issue [dart-lang/pub#3012][]).
[dart-lang/dartdoc#2740]: https://github.com/dart-lang/dartdoc/issues/2740
[dart-lang/dartdoc#2755]: https://github.com/dart-lang/dartdoc/issues/2755
[#46886]: https://github.com/dart-lang/sdk/issues/46886
[#45767]: https://github.com/dart-lang/sdk/issues/45767
[dart-lang/pub#3012]: https://github.com/dart-lang/pub/issues/3012
2021-09-10 07:57:35 +00:00
## 2.14.1 - 2021-09-09
- Fixed an issue specific to the macOS ARM64 (Apple Silicon) SDK, where the Dart
commandline tools did not have the expected startup performance.
## 2.14.0 - 2021-09-09
2021-04-08 16:51:00 +00:00
2021-07-09 17:14:15 +00:00
### 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.
- Prior to Dart 2.14, metadata (annotations) were not permitted to be specified
2023-01-24 18:00:25 +00:00
with generic type arguments. This restriction is lifted in Dart 2.14.
2021-07-09 17:14:15 +00:00
```dart
class C< T > {
const C();
}
@C (); // Previously permitted.
@C < int > (); // 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.
```dart
T wrapWithLogging< T > (T f) {
if (f is void Function< T > (T x)) {
return < S > (S x) {
print("Call: f< $S>($x)");
var r = f< S > (x);
print("Return: $x");
return r;
} as T;
} // More cases here
return f;
}
void foo< T > (T x) {
print("Foo!");
}
void main() {
// Previously an error, now permitted.
var f = wrapWithLogging< void Function < T > (T)>(foo);
f< int > (3);
}
```
2021-04-08 16:51:00 +00:00
### Core libraries
2021-04-23 05:24:41 +00:00
#### `dart:async`
2021-07-09 01:34:24 +00:00
- 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.
2021-06-22 20:03:13 +00:00
2021-07-09 01:34:24 +00:00
- Added `ignore()` as extension member on futures.
2021-06-22 20:03:13 +00:00
2021-07-09 01:34:24 +00:00
- Added `void unawaited(Future)` top-level function to deal with the
`unawaited_futures` lint.
2021-04-23 05:24:41 +00:00
2021-04-08 16:51:00 +00:00
#### `dart:core`
2021-07-09 01:34:24 +00:00
- Introduce `Enum` interface implemented by all `enum` declarations.
2021-06-25 14:08:16 +00:00
2021-07-09 01:34:24 +00:00
- 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.)
2021-04-08 16:51:00 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2021-07-05 16:41:57 +00:00
2021-07-09 01:34:24 +00:00
- The `Symbol` constructor now accepts any string as argument. Symbols are equal
if they were created from the same string.
2021-07-05 16:41:57 +00:00
2021-10-19 16:07:52 +00:00
2021-06-02 16:01:43 +00:00
#### `dart:ffi`
2022-04-05 14:57:53 +00:00
- Add the `DynamicLibrary.providesSymbol` function to check whether a symbol is
2021-07-09 01:34:24 +00:00
available in a dynamic library.
2022-04-05 14:57:53 +00:00
- Add `Union` native type for interacting with unions in native memory.
2021-06-02 16:01:43 +00:00
2021-06-25 21:47:29 +00:00
#### `dart:html`
2021-07-09 01:34:24 +00:00
- `convertNativeToDart_Dictionary()` now converts objects recursively, this
fixes APIs like MediaStreamTrack.getCapabilities that convert between Maps and
browser Dictionaries. [#44319]
2021-08-09 14:48:38 +00:00
- Added some access-control HTTP header names to `HttpHeaders` .
2021-06-25 21:47:29 +00:00
[#44319]: https://github.com/dart-lang/sdk/issues/44319
2021-05-20 13:13:42 +00:00
#### `dart:io`
2021-07-09 01:34:24 +00:00
- BREAKING CHANGE (for pre-migrated null safe code): `HttpClient` 's
`.authenticate` and `.authenticateProxy` setter callbacks must now accept a
nullable `realm` argument.
2021-08-09 14:48:38 +00:00
- Added some access-control HTTP header names to `HttpHeaders` .
2021-05-20 13:13:42 +00:00
2021-05-05 18:04:05 +00:00
#### `dart:typed_data`
2021-07-09 01:34:24 +00:00
- **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` .
2021-05-05 18:04:05 +00:00
2021-04-23 19:04:42 +00:00
#### `dart:web_sql`
2021-07-09 01:34:24 +00:00
- `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.
2021-04-23 19:04:42 +00:00
2021-07-09 01:34:24 +00:00
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.
2021-06-03 10:11:24 +00:00
Rereland "[vm/ffi] Disallow `Pointer`s and structs in finalizers and expandos"
`Dart_NewWeakPersistentHandle` and `Dart_NewFinalizableHandle` in
`dart_api.h` do no longer accept `Pointer`s and subtypes of `Struct`s
as values passed in to the `object` parameter.
Expandos no longer accept `Pointer`s and subtypes of `Struct`s
as values passed in to the `object` parameter.
Cleans up unused object_store->ffi_struct_class.
Reland 1: Allow importing `dart:ffi` from `dart:core` with
`--enable-ffi=false`.
Reland 2: Allow the new `_Compound` class to extend `NativeType`. (This
got triggered in this CL on the build because of the import
from `dart:core`.)
Closes: https://github.com/dart-lang/sdk/issues/45071
Breaking change: https://github.com/dart-lang/sdk/issues/45072
TEST=vm/cc/DartAPI_FinalizableHandleErrors
TEST=vm/cc/DartAPI_WeakPersistentHandleErrors
TEST=tests/ffi(_2)/expando_test.dart
Change-Id: I133278e16bd75cd2bb6234e7ddf042ffa0a54fd6
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,analyzer-analysis-server-linux-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-linux-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195079
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-04-14 12:07:18 +00:00
### Dart VM
2022-02-09 13:41:52 +00:00
- **Breaking change** [#45071][]: `Dart_NewWeakPersistentHandle` 's and
2021-07-09 01:34:24 +00:00
`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.
Rereland "[vm/ffi] Disallow `Pointer`s and structs in finalizers and expandos"
`Dart_NewWeakPersistentHandle` and `Dart_NewFinalizableHandle` in
`dart_api.h` do no longer accept `Pointer`s and subtypes of `Struct`s
as values passed in to the `object` parameter.
Expandos no longer accept `Pointer`s and subtypes of `Struct`s
as values passed in to the `object` parameter.
Cleans up unused object_store->ffi_struct_class.
Reland 1: Allow importing `dart:ffi` from `dart:core` with
`--enable-ffi=false`.
Reland 2: Allow the new `_Compound` class to extend `NativeType`. (This
got triggered in this CL on the build because of the import
from `dart:core`.)
Closes: https://github.com/dart-lang/sdk/issues/45071
Breaking change: https://github.com/dart-lang/sdk/issues/45072
TEST=vm/cc/DartAPI_FinalizableHandleErrors
TEST=vm/cc/DartAPI_WeakPersistentHandleErrors
TEST=tests/ffi(_2)/expando_test.dart
Change-Id: I133278e16bd75cd2bb6234e7ddf042ffa0a54fd6
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,analyzer-analysis-server-linux-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-linux-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195079
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-04-14 12:07:18 +00:00
[#45071]: https://github.com/dart-lang/sdk/issues/45071
2021-04-13 23:10:38 +00:00
### Tools
2021-05-10 16:44:40 +00:00
#### Dart command line
2022-02-09 13:41:52 +00:00
- **Breaking change** [#46100][]: The standalone `dart2native` tool has been
2021-07-09 01:34:24 +00:00
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.
2021-06-03 10:11:24 +00:00
2022-02-09 13:41:52 +00:00
- **Breaking change**: The standalone `dartfmt` tool has been marked deprecated,
2021-07-09 01:34:24 +00:00
and now prints a warning message. Instead, use `dart format` . The `dartfmt`
tool will be removed from the Dart SDK in Dart 2.15.
2021-06-03 10:11:24 +00:00
2021-07-09 01:34:24 +00:00
Note that `dart format` has [a different set of options and
defaults][dartfmt cli] than `dartfmt` .
2021-05-25 13:20:30 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2021-05-25 13:20:30 +00:00
2021-06-03 10:11:24 +00:00
[#46100]: https://github.com/dart-lang/sdk/issues/46100
[dartfmt cli]: https://github.com/dart-lang/dart_style/wiki/CLI-Changes
2021-05-10 16:44:40 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2021-06-02 20:11:24 +00:00
2021-07-09 01:34:24 +00:00
- The `dartanalyzer` command's JSON output mode has been changed to emit the
JSON output on stdout instead of stderr.
2021-06-17 23:39:51 +00:00
2021-07-08 23:50:53 +00:00
#### dart format
2021-07-09 17:14:15 +00:00
- Simplify and optimize cascade formatting. See:
https://github.com/dart-lang/dart_style/pull/1033
- Don't unnecessarily split argument lists with `/* */` comments.
- Return correct exit code from `FormatCommand` when formatting stdin.
- Split empty catch blocks with finally clauses or catches after them.
2021-07-08 23:50:53 +00:00
2021-04-13 23:10:38 +00:00
#### Linter
2021-09-07 17:14:33 +00:00
Updated the Linter to `1.8.0` , which includes changes that
2021-07-28 03:18:44 +00:00
- improve performance for `prefer_is_not_empty` .
- fix false positives in `no_logic_in_create_state` .
- improve `package_names` to allow dart identifiers as package names.
- fix a false-positive in `package_names` (causing keywords to wrongly get flagged).
- fix `avoid_classes_with_only_static_member` to check for inherited members and also
flag classes with only methods.
- fix `curly_braces_in_flow_control_structures` to properly flag terminating `else-if`
blocks.
- improve `always_specify_types` to support type aliases.
2021-08-31 15:09:40 +00:00
- fix a false positive in `unnecessary_string_interpolations` w/ nullable interpolated
2021-07-28 03:18:44 +00:00
strings
- fix a false positive in `avoid_function_literals_in_foreach_calls` for nullable
iterables.
- fix false positives in `avoid_returning_null` w/ NNBD
- fix false positives in `use_late_for_private_fields_and_variables` in the presence
of const constructors.
- adds a new lint: `eol_at_end_of_file` .
2021-07-01 16:16:28 +00:00
- fix case-sensitive false positive in `use_full_hex_values_for_flutter_colors` .
2021-07-09 01:34:24 +00:00
- improve try-block and switch statement flow analysis for
2021-07-01 16:16:28 +00:00
`use_build_context_synchronously` .
2021-07-09 01:34:24 +00:00
- update `use_setters_to_change_properties` to only highlight a method name, not
the entire body and doc comment.
2021-07-01 16:16:28 +00:00
- 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 `+=` ).
2021-07-09 01:34:24 +00:00
- relax `non_constant_identifier_names` to allow for a trailing underscore.
- fix false negative in `prefer_final_parameters` where first parameter is
final.
2021-06-23 10:25:13 +00:00
- improve `directives_ordering` sorting of directives with dot paths and
2021-06-15 22:31:23 +00:00
dot-separated package names.
- (internal) migrate to `SecurityLintCode` instead of deprecated
2021-06-01 21:09:06 +00:00
`SecurityLintCodeWithUniqueName` .
2021-06-15 22:31:23 +00:00
- (internal) fix `avoid_types_as_parameter_names` to skip field formal
2021-06-01 21:09:06 +00:00
parameters.
2021-07-09 01:34:24 +00:00
- 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.
2021-06-15 22:31:23 +00:00
- add new lint: `depend_on_referenced_packages` .
2021-06-01 21:09:06 +00:00
- update `avoid_returning_null_for_future` to skip checks for null-safe
libraries.
2021-06-15 22:31:23 +00:00
- add new lint: `use_test_throws_matchers` .
- relax `sort_child_properties_last` to accept closures after child.
- improve performance for `prefer_contains` and `prefer_is_empty` .
- add new lint: `noop_primitive_operations` .
- mark `avoid_web_libraries_in_flutter` as stable.
- add new lint: `prefer_final_parameters` .
- update `prefer_initializing_formals` to allow assignments where identifier
2021-06-01 21:09:06 +00:00
names don't match.
2021-06-15 22:31:23 +00:00
- update `directives_ordering` to checks ordering of `package:` imports in code
2021-04-27 23:53:52 +00:00
outside pub packages.
2021-06-15 22:31:23 +00:00
- add simple reachability analysis to `use_build_context_synchronously` to
2021-04-27 23:53:52 +00:00
short-circuit await-discovery in terminating blocks.
2021-06-15 22:31:23 +00:00
- update `use_build_context_synchronously` to recognize nullable types when
2021-04-27 23:53:52 +00:00
accessed from legacy libraries.
2021-04-13 23:10:38 +00:00
2021-05-11 10:45:53 +00:00
#### Pub
2021-07-09 01:34:24 +00:00
- `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.
2021-05-11 10:45:53 +00:00
pub no longer queries git for listing the files. This implies:
2021-07-09 01:34:24 +00:00
- Checked in files will now be ignored if they are included by a `.gitignore`
2021-05-11 10:45:53 +00:00
rule.
2021-07-09 01:34:24 +00:00
- Global ignores are no longer taken into account.
- Even packages that are not in git source control will have their
2021-05-11 10:45:53 +00:00
`.gitignore` files respected.
2021-07-09 01:34:24 +00:00
- `.gitignore` and `.pubignore` is always case-insensitive on MacOs and
2021-05-25 17:41:32 +00:00
Windows (as is default for `git` repositories).
2021-05-11 10:45:53 +00:00
2021-07-09 01:34:24 +00:00
- New flag `dart pub deps --json` gives a machine parsable overview of the
2021-05-11 10:45:53 +00:00
current dependencies.
2021-07-09 01:34:24 +00:00
- New command: `dart pub cache clean` . Will delete everything in your current
2021-05-11 10:45:53 +00:00
pub cache.
2021-07-09 01:34:24 +00:00
- Commands related to a single package now takes a `--directory` option to
2021-05-11 10:45:53 +00:00
operate on a package in the given directory instead of the working directory.
2021-07-09 01:34:24 +00:00
- git dependencies with a relative repo url would previously be interpreted
2021-05-11 10:45:53 +00:00
relative to the current package, even for transitive dependencies. This now
fails instead.
2021-07-09 01:34:24 +00:00
- 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
2021-05-25 17:41:32 +00:00
dependencies when using `dart run <package>:<command>` .
2021-05-11 10:45:53 +00:00
2021-07-09 20:32:56 +00:00
#### Dart2JS
2022-02-09 13:41:52 +00:00
* **Breaking change** [#46545][]: Dart2JS emits ES6+ JavaScript by default,
2021-07-09 20:32:56 +00:00
thereby no longer supporting legacy browsers. Passing the
`--legacy-javascript` flag will let you opt out of this update, but this
flag will be removed in a future release. Modern browsers will not be
affected, as Dart2JS continues to support [last two major releases][1] of
2021-08-31 15:09:40 +00:00
Edge, Safari, Firefox, and Chrome.
2021-07-09 20:32:56 +00:00
[#46545]: https://github.com/dart-lang/sdk/issues/46545
[1]: https://dart.dev/faq#q-what-browsers-do-you-support-as-javascript-compilation-targets
2021-07-30 00:33:54 +00:00
#### Dart Dev Compiler (DDC)
2022-02-09 13:41:52 +00:00
- **Breaking change** [#44154][]: Subtyping relations of `package:js` classes
2021-07-30 00:33:54 +00:00
have been changed to be more correct and consistent with Dart2JS.
Like `anonymous` classes, non-`anonymous` classes will no longer check the
underlying type in DDC. The internal type representation of these objects have
changed as well, which will affect the `toString` value of these types.
[#44154]: https://github.com/dart-lang/sdk/issues/44154
2021-06-23 10:25:13 +00:00
## 2.13.4 - 2021-06-28
This is a patch release that fixes:
2021-07-09 01:34:24 +00:00
- a Dart VM compiler crash (issue [flutter/flutter#84212][]).
- a DDC compiler crash (issue [flutter/flutter#82838][]).
2021-06-23 10:25:13 +00:00
[flutter/flutter#84212]: https://github.com/flutter/flutter/issues/84212
[flutter/flutter#82838]: https://github.com/flutter/flutter/issues/82838
2021-06-09 10:30:19 +00:00
## 2.13.3 - 2021-06-10
2021-06-07 10:53:09 +00:00
This is a patch release that fixes:
2021-07-09 01:34:24 +00:00
- a Dart compiler crash (issue [flutter/flutter#83094][]).
- an analysis server deadlock causing it to stop responding to IDE requests
2021-06-07 10:53:09 +00:00
(issue [#45996][]).
2021-07-09 01:34:24 +00:00
- an analyzer crash when analyzing against `package:meta` `v1.4.0` (issue
2021-06-07 10:53:09 +00:00
[#46183][]).
[flutter/flutter#83094]: https://github.com/flutter/flutter/issues/83094
[#45996]: https://github.com/dart-lang/sdk/issues/45996
[#46183]: https://github.com/dart-lang/sdk/issues/46183
2021-05-21 10:42:11 +00:00
## 2.13.1 - 2021-05-25
This is a patch release that fixes:
2021-07-09 01:34:24 +00:00
- incorrect behavior in CastMap (issue [#45473][]).
- missing nullability from recursive type hierarchies in DDC (issue [#45767][]).
2021-05-21 10:42:11 +00:00
[#45473]: https://github.com/dart-lang/sdk/issues/45473
[#45767]: https://github.com/dart-lang/sdk/issues/45767
2021-05-12 11:23:13 +00:00
## 2.13.0 - 2021-05-18
2021-02-09 14:38:46 +00:00
### Language
2021-07-09 01:34:24 +00:00
- **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.
2021-04-03 01:31:42 +00:00
2021-07-09 01:34:24 +00:00
```dart
import 'dart:convert';
2021-04-03 01:31:42 +00:00
2021-07-09 01:34:24 +00:00
typedef JsonMap = Map< String , dynamic > ;
2021-04-03 01:31:42 +00:00
2021-07-09 01:34:24 +00:00
JsonMap parseJsonMap(String input) => json.decode(input) as JsonMap;
```
2021-04-03 01:31:42 +00:00
2021-07-09 01:34:24 +00:00
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.
2021-04-03 01:31:42 +00:00
2021-07-09 01:34:24 +00:00
```dart
class NewClassName< T > {
NewClassName.create(T x);
static NewClassName< T > mkOne< T > (T x) => NewClassName< T > .create(x);
}
@Deprecated ("Use NewClassName instead")
typedef OldClassName< T > = NewClassName< T > ;
class LegacyClass extends OldClassName< int > {
LegacyClass() : super.create(3);
}
OldClassName< int > legacyCode() {
var one = OldClassName.create(1);
var two = OldClassName.mkOne(2);
return LegacyClass();
}
```
2021-04-03 01:31:42 +00:00
2021-07-09 01:34:24 +00:00
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.
2021-04-03 01:31:42 +00:00
2021-07-09 01:34:24 +00:00
[non-function type aliases]:
https://github.com/dart-lang/language/blob/master/accepted/2.13/nonfunction-type-aliases/feature-specification.md
2021-04-03 01:31:42 +00:00
2021-02-09 14:38:46 +00:00
### Core libraries
2021-03-22 13:20:13 +00:00
#### `dart:collection`
2021-07-09 01:34:24 +00:00
- 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).
2021-05-17 21:55:02 +00:00
2021-07-09 01:34:24 +00:00
- 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).
2021-03-22 13:20:13 +00:00
2021-04-07 20:02:17 +00:00
#### `dart:developer`
2021-07-09 01:34:24 +00:00
- Added `serverWebSocketUri` property to `ServiceProtocolInfo` .
2021-04-07 20:02:17 +00:00
2022-04-05 14:57:53 +00:00
#### `dart:ffi`
- Add `Packed` for interacting with packed structs in native memory.
- Add `Array` for interacting with structs with inline arrays.
2021-02-09 14:38:46 +00:00
### Dart VM
### Tools
2021-04-02 02:20:48 +00:00
#### Analyzer
2021-07-09 01:34:24 +00:00
- 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
```
2021-02-09 14:38:46 +00:00
2021-04-06 14:32:37 +00:00
#### dart format
2021-07-09 01:34:24 +00:00
- Correct constructor initializer indentation after `required` named parameters.
2021-04-06 14:32:37 +00:00
2021-03-03 18:56:54 +00:00
#### Linter
2021-03-23 15:01:16 +00:00
Updated the Linter to `1.2.1` , which includes:
2021-03-03 18:56:54 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2021-02-09 14:38:46 +00:00
2021-03-25 19:58:44 +00:00
### Other libraries
#### `package:js`
2021-07-09 01:34:24 +00:00
- **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.
2021-03-25 19:58:44 +00:00
[#44211]: https://github.com/dart-lang/sdk/issues/44211
2021-04-15 10:17:19 +00:00
## 2.12.4 - 2021-04-15
This is a patch release that fixes a Dart VM compiler crashes when compiling
initializers containing async closures (issue [#45306][]).
[#45306]: https://github.com/dart-lang/sdk/issues/45306
## 2.12.3 - 2021-04-14
2021-04-13 23:29:08 +00:00
2022-02-09 13:41:52 +00:00
**Security advisory**: This is a patch release that fixes a vulnerability in
`dart:html` related to DOM clobbering. See the security advisory
[CVE-2021-22540][cve-2021-22540] for more details. Thanks again to **Vincenzo di
Cicco** for finding and reporting this vulnerability.
2021-04-30 20:52:16 +00:00
2021-07-09 01:34:24 +00:00
[cve-2021-22540]:
https://github.com/dart-lang/sdk/security/advisories/GHSA-3rfv-4jvg-9522
2021-04-13 23:29:08 +00:00
2021-03-17 09:24:41 +00:00
## 2.12.2 - 2021-03-17
This is a patch release that fixes crashes reported by Flutter 2 users (issue
[flutter/flutter#78167][]).
[flutter/flutter#78167]: https://github.com/flutter/flutter/issues/78167
2021-03-10 09:14:51 +00:00
## 2.12.1 - 2021-03-10
This is a patch release that fixes:
2021-07-09 01:34:24 +00:00
- an unhandled exception in HTTPS connections (issue [#45047][]).
- a typing issue in the typed_data `+` operator (issue [#45140][]).
2021-03-10 09:14:51 +00:00
[#45047]: https://github.com/dart-lang/sdk/issues/45047
[#45140]: https://github.com/dart-lang/sdk/issues/45140
## 2.12.0 - 2021-03-03
2020-10-29 18:25:56 +00:00
### Language
2022-02-09 13:41:52 +00:00
- **Breaking change** [Null safety][] is now enabled by default in all code that
2021-07-09 01:34:24 +00:00
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.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
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.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
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:
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Smarter flow analysis and type promotion
- `required` named parameters
- `late` variables
- The postfix `!` null assertion operator
- The `?..` and `?[]` null-aware operators
2021-01-20 20:28:07 +00:00
2022-02-09 13:41:52 +00:00
- **Breaking change** [#44660][]: Fixed an implementation bug where `this` would
2021-07-09 01:34:24 +00:00
sometimes undergo type promotion in extensions.
2021-01-20 20:28:07 +00:00
2021-02-18 23:18:00 +00:00
[null safety]: https://dart.dev/null-safety/understanding-null-safety
2021-07-09 01:34:24 +00:00
[language version]:
https://dart.dev/guides/language/evolution#language-versioning
2021-01-20 20:28:07 +00:00
[#44660]: https://github.com/dart-lang/sdk/issues/44660
2020-09-21 10:41:46 +00:00
### Core libraries
2021-01-21 23:13:56 +00:00
#### `dart:async`
2021-07-09 01:34:24 +00:00
- Add extension method `onError()` on `Future` to allow better typing of error
callbacks.
2021-01-21 23:13:56 +00:00
2020-12-10 11:00:27 +00:00
#### `dart:collection`
2021-07-09 01:34:24 +00:00
- Add `UnmodifiableSetView` class, which allows users to guarantee that methods
that could change underlying `Set` instance can not be invoked.
2020-12-10 11:00:27 +00:00
2021-07-09 01:34:24 +00:00
- Make it explicit that `LinkedList` compares elements by identity, and update
`contains()` to take advantage of this.
2021-01-21 23:13:56 +00:00
2020-12-10 11:00:27 +00:00
#### `dart:core`
2021-07-09 01:34:24 +00:00
- Add `Set.unmodifiable()` constructor, which allows users to create
unmodifiable `Set` instances.
2020-12-10 11:00:27 +00:00
2022-04-05 14:57:53 +00:00
#### `dart:ffi`
- **Breaking change** [#44621][]: Invocations with a generic `T` of `sizeOf<T>` ,
`Pointer<T>.elementAt()` , `Pointer<T extends Struct>.ref` , and
`Pointer<T extends Struct>[]` 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<T>` 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` .
[#44621]: https://github.com/dart-lang/sdk/issues/44621
[#44622]: https://github.com/dart-lang/sdk/issues/44622
2020-10-01 14:02:40 +00:00
#### `dart:io`
2021-07-09 01:34:24 +00:00
- `HttpRequest` now correctly follows HTTP 308 redirects
(`HttpStatus.permanentRedirect`).
2020-10-29 02:52:03 +00:00
#### `dart:isolate`
2021-07-09 01:34:24 +00:00
- Add `debugName` positional parameter to `ReceivePort` and `RawReceivePort`
constructors, a name which can be associated with the port and displayed in
tooling.
2021-10-01 22:04:36 +00:00
- Introduce `Isolate.exit([port, message])` which terminates current isolate
and, if `port` is specified, as a last action sends out the `message` out to
that `port` .
2020-10-01 14:02:40 +00:00
2020-12-09 01:44:38 +00:00
#### `dart:html`
2021-07-09 01:34:24 +00:00
- `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.
2020-12-09 01:44:38 +00:00
[#44157]: https://github.com/dart-lang/sdk/issues/44157
2020-09-21 10:41:46 +00:00
### Dart VM
2022-02-09 13:41:52 +00:00
- **Breaking change** [#42312][]: `Dart_WeakPersistentHandle` s no longer
2021-07-09 01:34:24 +00:00
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.
2021-02-18 23:18:00 +00:00
2022-02-09 13:41:52 +00:00
- **Breaking change** [#42312][]: `Dart_WeakPersistentHandleFinalizer` is
2021-07-09 01:34:24 +00:00
renamed to `Dart_HandleFinalizer` and had its `handle` argument removed. All
API functions using that type have been updated.
[vm] Native API: Make Dart_NewWeakPersistentHandle not auto delete
Changes Dart_NewWeakPersistentHandle to no longer auto delete the
weak persistent handle.
Changes the signatures of WeakPersistentHandleFinalizers to no longer
have access to the handle.
Flutter PR: https://github.com/flutter/engine/pull/19843
g3 presubmit: cl/318028238
Issue: https://github.com/dart-lang/sdk/issues/42312
TEST=runtime/vm/dart_api_impl_test.cc
Change-Id: I3f77db9954d9486759f903b78c03a494f73c68ba
Cq-Include-Trybots:dart/try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try,analyzer-nnbd-linux-release-try,front-end-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151525
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-11-03 10:27:44 +00:00
[#42312]: https://github.com/dart-lang/sdk/issues/42312
2020-09-21 10:41:46 +00:00
### Dart2JS
2021-07-09 01:34:24 +00:00
- Remove `--no-defer-class-types` and `--no-new-deferred-split` .
2020-09-25 17:04:14 +00:00
2020-09-21 10:41:46 +00:00
### Tools
2021-04-02 02:20:48 +00:00
#### Analyzer
2020-09-23 19:21:59 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Report diagnostics regarding the
[`@internal` ](https://pub.dev/documentation/meta/latest/meta/internal-constant.html )
annotation.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Improve diagnostic-reporting regarding the
[`@doNotStore` ](https://pub.dev/documentation/meta/latest/meta/doNotStore-constant.html )
annotation.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Introduce a diagnostic which is reported when a library member named `main` is
not a function.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Introduce a diagnostic which is reported when a `main` function's first
parameter is not a supertype of `List<String>` .
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Introduce diagnostics for when an `// ignore` comment contains an error code
which is not being reported, cannot be ignored, or is already being ignored.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Report diagnostics when using
[`@visibleForTesting`](https://pub.dev/documentation/meta/latest/meta/
visibleForTesting-constant.html) on top-level variables.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Fix false positive reports of "unused element" for top-level setters and
getters.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Fix false positive reports regarding `@deprecated` field formal parameters at
their declaration.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- For null safety, introduce a diagnostic which reports when a null-check will
always fail.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Fix false positive reports regarding optional parameters on private
constructors being unused.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Introduce a diagnostic which is reported when a constructor includes duplicate
field formal parameters.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Improve the "unused import" diagnostic when multiple import directives share a
common prefix.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Fix false positive "unused import" diagnostic regarding an import which
provides an extension method which is used.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- For null safety, improve the messaging of "use of nullable value" diagnostics
for eight different contexts.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Fix false positive reports regarding `@visibleForTesting` members in a "hide"
combinator of an import or export directive.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Improve the messaging of "invalid override" diagnostics.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Introduce a diagnostic which is reported when `Future<T>.catchError` is called
with an `onError` callback which does not return `FutureOr<T>` .
2020-09-23 19:21:59 +00:00
2020-11-02 23:47:40 +00:00
#### dartfmt
2021-07-09 01:34:24 +00:00
- Don't duplicate comments on chained if elements.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Preserve `?` in initializing formal function-typed parameters.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Fix performance issue with constructors that have no initializer list.
2020-11-02 23:47:40 +00:00
2020-09-21 10:41:46 +00:00
#### Linter
2021-01-21 20:13:22 +00:00
Updated the Linter to `0.1.129` , which includes:
2020-12-01 02:10:44 +00:00
2021-07-09 01:34:24 +00:00
- 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` .
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Fix crash in `prefer_collection_literals` when there is no static parameter
element.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Update to `package_names` to allow leading underscores.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Fix crashes in `unnecessary_null_checks` and
`missing_whitespace_between_adjacent_strings` .
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Update to `void_checks` for null safety.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Fix range error in `unnecessary_string_escapes` .
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Fix false positives in `unnecessary_null_types` .
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Fix to `prefer_constructors_over_static_methods` to respect type parameters.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Update to `always_require_non_null_named_parameters` to be null safety-aware.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Update to `unnecessary_nullable_for_final_variable_declarations` to allow
dynamic.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Update `overridden_fields` to not report on abstract parent fields.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Fix to `unrelated_type_equality_checks` for null safety.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Improvements to `type_init_formals` to allow types not equal to the field type.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Updates to `public_member_apis` to check generic type aliases.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Fix `close_sinks` to handle `this` -prefixed property accesses.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Fix `unawaited_futures` to handle `Future` subtypes.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- Performance improvements to `always_use_package_imports` ,
`avoid_renaming_method_parameters` , `prefer_relative_imports` and
`public_member_api_docs` .
2020-09-21 10:41:46 +00:00
2020-10-29 13:55:33 +00:00
#### Pub
2021-07-09 01:34:24 +00:00
- **Breaking**: The Dart SDK constraint is now **required** in `pubspec.yaml` .
You must include a section like:
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
```yaml
environment:
sdk: ">=2.10.0 < 3.0.0 "
```
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
See [#44072][].
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
For legacy dependencies without an SDK constraint, pub will now assume a
default language version of 2.7.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- The top level `pub` executable has been deprecated. Use `dart pub` instead.
See [dart tool][].
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- New command `dart pub add` that adds new dependencies to your `pubspec.yaml` ,
and a corresponding `dart pub remove` that removes dependencies.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- New option `dart pub upgrade --major-versions` will update constraints in your
2021-10-20 09:29:01 +00:00
`pubspec.yaml` to match the _resolvable_ column reported in
2021-07-09 01:34:24 +00:00
`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` .
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
It is also possible to only upgrade the major version for a subset of your
dependencies using `dart pub upgrade --major-versions <dependencies...>` .
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- New option `dart pub outdated --mode=null-safety` that will analyze your
dependencies for null-safety.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- `dart pub get` and `dart pub upgrade` will highlight dependencies that have
been [discontinued ](https://dart.dev/tools/pub/publishing#discontinue ) on
pub.dev.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- `dart pub publish` will now check your pubspec keys for likely typos.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- `dart pub upgrade package_foo` fetchs dependencies but ignores the
`pubspec.lock` for `package_foo` , allowing users to only upgrade a subset of
dependencies.
2021-02-18 23:18:00 +00:00
2023-01-20 12:37:49 +00:00
- New command `dart pub login` that logs into pub.dev.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2021-02-18 23:18:00 +00:00
2021-07-09 01:34:24 +00:00
- `pub global activate` no longer re-precompiles if the current global
installation was same version.
2020-11-06 15:36:02 +00:00
2021-07-09 01:34:24 +00:00
- The Flutter SDK constraint upper bound is now ignored in pubspecs and
deprecated when publishing. See: [flutter-upper-bound-deprecation][].
2021-01-07 10:55:48 +00:00
2021-07-09 01:34:24 +00:00
[flutter-upper-bound-deprecation]:
https://dart.dev/go/flutter-upper-bound-deprecation
2020-11-06 15:36:02 +00:00
[#44072]: https://github.com/dart-lang/sdk/issues/44072
[dart tool]: https://dart.dev/tools/dart-tool
2020-10-29 13:55:33 +00:00
2021-03-10 09:14:51 +00:00
## 2.10.5 - 2021-01-21
2021-01-19 11:30:50 +00:00
This is a patch release that fixes a crash in the Dart VM. (issue [#44563][]).
[#44563]: https://github.com/dart-lang/sdk/issues/44563
2020-11-11 12:30:42 +00:00
## 2.10.4 - 2020-11-12
This is a patch release that fixes a crash in the Dart VM (issues [#43941][],
[flutter/flutter#43620][], and [Dart-Code/Dart-Code#2814][]).
[#43941]: https://github.com/dart-lang/sdk/issues/43941
[flutter/flutter#43620]: https://github.com/flutter/flutter/issues/43620
2021-07-09 01:34:24 +00:00
[dart-code/dart-code#2814]: https://github.com/Dart-Code/Dart-Code/issues/2814
2020-11-11 12:30:42 +00:00
2020-10-27 13:36:23 +00:00
## 2.10.3 - 2020-10-29
This is a patch release that fixes the following issues:
2021-07-09 01:34:24 +00:00
- breaking changes in Chrome 86 that affect DDC (issues [#43750][] and
2020-10-27 13:36:23 +00:00
[#43193][]).
2021-07-09 01:34:24 +00:00
- compiler error causing incorrect use of positional parameters when named
2020-10-27 13:36:23 +00:00
parameters should be used instead (issues [flutter/flutter#65324][] and
[flutter/flutter#68092][]).
2023-01-24 18:00:25 +00:00
- crashes and/or undefined behavior in AOT compiled code (issues [#43770][] and
2020-10-27 13:36:23 +00:00
[#43786][]).
2021-07-09 01:34:24 +00:00
- AOT compilation of classes with more than 64 unboxed fields (issue
[flutter/flutter#67803][]).
2020-10-27 13:36:23 +00:00
[#43750]: https://github.com/dart-lang/sdk/issues/43750
[#43193]: https://github.com/dart-lang/sdk/issues/43193
[flutter/flutter#65324]: https://github.com/flutter/flutter/issues/65324
[flutter/flutter#68092]: https://github.com/flutter/flutter/issues/68092
[#43770]: https://github.com/dart-lang/sdk/issues/43770
[#43786]: https://github.com/dart-lang/sdk/issues/43786
[flutter/flutter#67803]: https://github.com/flutter/flutter/issues/67803
2020-10-15 12:13:01 +00:00
## 2.10.2 - 2020-10-15
2020-10-13 13:43:44 +00:00
This is a patch release that fixes a DDC compiler crash (issue [#43589]).
[#43589]: https://github.com/dart-lang/sdk/issues/43589
2020-10-06 08:37:16 +00:00
## 2.10.1 - 2020-10-06
This is a patch release that fixes the following issues:
2021-07-09 01:34:24 +00:00
- crashes when developing Flutter applications (issue [#43464][]).
- non-deterministic incorrect program behaviour and/or crashes (issue
2020-10-06 08:37:16 +00:00
[flutter/flutter#66672][]).
2021-07-09 01:34:24 +00:00
- uncaught TypeErrors in DDC (issue [#43661][]).
2020-10-06 08:37:16 +00:00
[#43464]: https://github.com/dart-lang/sdk/issues/43464
[flutter/flutter#66672]: https://github.com/flutter/flutter/issues/66672
[#43661]: https://github.com/dart-lang/sdk/issues/43661
2020-09-21 10:41:46 +00:00
## 2.10.0 - 2020-09-28
[vm] Native API: Introduce Dart_FinalizableHandle
Introduces Dart_NewFinalizableHandle which does auto delete itself,
but does not allow accessing the weak referenced object.
Issue: https://github.com/dart-lang/sdk/issues/42312
Change-Id: I24ea732925122c453213c4fa3f629761c352f838
Cq-Include-Trybots:dart/try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try,analyzer-nnbd-linux-release-try,front-end-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154695
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-23 11:30:39 +00:00
2020-08-05 17:07:04 +00:00
### Core libraries
2020-08-14 01:01:13 +00:00
#### `dart:io`
2021-07-09 01:34:24 +00:00
- 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.
2020-08-14 01:01:13 +00:00
2020-08-05 17:07:04 +00:00
#### `dart:typed_data`
2021-07-09 01:34:24 +00:00
- Class `BytesBuilder` is moved from `dart:io` to `dart:typed_data` . It's
temporarily being exported from `dart:io` as well.
2020-08-05 17:07:04 +00:00
2021-01-11 15:22:06 +00:00
### `dart:uri`
2021-07-09 01:34:24 +00:00
- [#42564]: Solved inconsistency in `Uri.https` and `Uri.http` constructors'
`queryParams` type.
2021-01-11 15:22:06 +00:00
[vm] Native API: Introduce Dart_FinalizableHandle
Introduces Dart_NewFinalizableHandle which does auto delete itself,
but does not allow accessing the weak referenced object.
Issue: https://github.com/dart-lang/sdk/issues/42312
Change-Id: I24ea732925122c453213c4fa3f629761c352f838
Cq-Include-Trybots:dart/try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try,analyzer-nnbd-linux-release-try,front-end-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154695
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-23 11:30:39 +00:00
### Dart VM
2022-02-09 13:41:52 +00:00
- **Breaking change** [#42982][]: `dart_api_dl.cc` is renamed to `dart_api_dl.c`
2021-07-09 01:34:24 +00:00
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.
[vm] Native API: Introduce Dart_FinalizableHandle
Introduces Dart_NewFinalizableHandle which does auto delete itself,
but does not allow accessing the weak referenced object.
Issue: https://github.com/dart-lang/sdk/issues/42312
Change-Id: I24ea732925122c453213c4fa3f629761c352f838
Cq-Include-Trybots:dart/try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try,analyzer-nnbd-linux-release-try,front-end-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154695
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-23 11:30:39 +00:00
2020-08-17 20:25:09 +00:00
### Dart2JS
2022-06-15 11:08:28 +00:00
- Adds support for deferred loading of types separately from classes. This
2021-07-09 01:34:24 +00:00
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
2022-06-15 11:08:28 +00:00
loading types separately from classes will allow us to fix the unsoundness
2021-07-09 01:34:24 +00:00
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][].
2020-08-17 20:25:09 +00:00
2020-08-10 15:11:21 +00:00
[#42982]: https://github.com/dart-lang/sdk/issues/42982
2021-07-09 01:34:24 +00:00
[unsoundness in the deferred loading algorithm]:
https://github.com/dart-lang/sdk/blob/302ad7ab2cd2de936254850550aad128ae76bbb7/CHANGELOG.md#dart2js-3
2020-08-10 15:11:21 +00:00
2020-08-08 05:41:21 +00:00
### Tools
2020-08-31 18:07:44 +00:00
#### dartfmt
2021-07-09 01:34:24 +00:00
- Don't crash when non-ASCII whitespace is trimmed.
- Split all conditional expressions (`?:`) when they are nested.
- Handle `external` and `abstract` fields and variables.
2020-08-31 18:07:44 +00:00
2020-08-08 05:41:21 +00:00
#### Linter
2020-09-21 10:41:46 +00:00
Updated the Linter to `0.1.118` , which includes:
2020-08-08 05:41:21 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2020-08-08 05:41:21 +00:00
2020-08-14 10:20:07 +00:00
#### Pub
2021-07-09 01:34:24 +00:00
- `pub run` and `pub global run` accepts a `--(no-)-sound-null-safety` flag,
2020-08-14 10:20:07 +00:00
that is passed to the VM.
2021-07-09 01:34:24 +00:00
- 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.
2020-08-14 10:20:07 +00:00
2020-09-08 09:16:58 +00:00
## 2.9.3 - 2020-09-08
This is a patch release that fixes DDC to handle a breaking change in Chrome
(issue [#43193][]).
[#43193]: https://github.com/dart-lang/sdk/issues/43193
2020-08-26 10:34:06 +00:00
## 2.9.2 - 2020-08-26
This is a patch release that fixes transient StackOverflow exceptions when
building Flutter applications (issue [flutter/flutter#63560][]).
[flutter/flutter#63560]: https://github.com/flutter/flutter/issues/63560
2020-08-12 10:32:58 +00:00
## 2.9.1 - 2020-08-12
This is a patch release that fixes unhandled exceptions in some Flutter
applications (issue [flutter/flutter#63038][]).
[flutter/flutter#63038]: https://github.com/flutter/flutter/issues/63038
2020-08-05 18:26:11 +00:00
## 2.9.0 - 2020-08-05
2020-04-21 14:28:53 +00:00
### Language
### Core libraries
2020-06-29 14:04:53 +00:00
#### `dart:async`
2020-05-29 18:45:04 +00:00
2021-07-09 01:34:24 +00:00
- Adds `Stream.multi` constructor creating streams which can be listened to more
than once, and where each individual listener can be controlled independently.
2020-05-29 18:45:04 +00:00
2020-05-04 10:48:32 +00:00
#### `dart:convert`
2022-02-09 13:41:52 +00:00
- **Breaking change** [#41100][]: When encoding a string containing unpaired
2021-07-09 01:34:24 +00:00
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][].
2020-05-04 10:48:32 +00:00
[#41100]: https://github.com/dart-lang/sdk/issues/41100
2021-07-09 01:34:24 +00:00
[whatwg encoding standard]: https://encoding.spec.whatwg.org/#utf-8-decoder
2020-05-04 10:48:32 +00:00
2020-06-29 14:04:53 +00:00
#### `dart:io`
2021-07-09 01:34:24 +00:00
- [#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.
2020-06-29 14:04:53 +00:00
[#42006]: https://github.com/dart-lang/sdk/issues/42006
2021-07-09 01:34:24 +00:00
[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
2020-06-29 14:04:53 +00:00
2020-04-21 14:28:53 +00:00
#### `dart:html`
2022-02-09 13:41:52 +00:00
- **Breaking change**: `CssClassSet.add()` previously returned `null` if the
2021-07-09 01:34:24 +00:00
`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` .
2020-04-21 14:28:53 +00:00
2021-07-09 01:34:24 +00:00
- `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.
2020-05-06 19:30:17 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2020-06-30 23:32:27 +00:00
2020-06-29 14:04:53 +00:00
[#41653]: https://github.com/dart-lang/sdk/issues/41653
2020-04-21 14:28:53 +00:00
2020-07-16 00:12:22 +00:00
#### `dart:mirrors`
2022-02-09 13:41:52 +00:00
- **Breaking change** [#42714][]: web compilers (dart2js and DDC) now produce a
2021-07-09 01:34:24 +00:00
compile-time error if `dart:mirrors` is imported.
2020-07-16 00:12:22 +00:00
2021-07-09 01:34:24 +00:00
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.
2020-07-16 00:12:22 +00:00
[#42714]: https://github.com/dart-lang/sdk/issues/42714
2020-04-22 18:18:39 +00:00
### Tools
2020-04-24 07:40:21 +00:00
#### dartfmt
2021-07-09 01:34:24 +00:00
- 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 `?[]` .
2020-04-24 07:40:21 +00:00
2021-04-02 02:20:48 +00:00
#### Analyzer
2021-07-09 01:34:24 +00:00
- Static analyses with a severity of "error" can no longer be ignored with
2021-04-02 02:20:48 +00:00
comments (`// ignore: code` and `// ignore_for_file: code` ).
2020-04-22 18:18:39 +00:00
#### Linter
2020-08-08 05:41:21 +00:00
Updated the Linter to `0.1.117` , which includes:
2020-08-06 23:11:09 +00:00
2021-07-09 01:34:24 +00:00
- 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
2020-06-11 18:44:11 +00:00
contexts.
2021-07-09 01:34:24 +00:00
- 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
2020-06-11 18:44:11 +00:00
assignments.
2021-07-09 01:34:24 +00:00
- Updated `unnecessary_lambdas` to check for tear-off assignability.
- Updated `unsafe_html` to use a `SecurityLintCode` (making it un-ignorable) and
2020-06-11 18:44:11 +00:00
to include `Window.open` , `Element.html` and `DocumentFragment.html` in unsafe
API checks. Also added checks for attributes and methods on extensions.
2020-04-22 18:18:39 +00:00
2020-04-21 14:28:53 +00:00
### Dart VM
2022-02-09 13:41:52 +00:00
- **Breaking change** [#41100][]: When printing a string using the `print`
2021-07-09 01:34:24 +00:00
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.
2020-06-29 16:10:13 +00:00
2020-05-20 13:06:02 +00:00
### Pub
2021-07-09 01:34:24 +00:00
- `pub run` and `pub global run` accepts a `--enable-experiment` flag enabling
2020-06-03 21:32:39 +00:00
experiments in the Dart VM (and language).
2021-07-09 01:34:24 +00:00
- 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
2020-07-17 23:58:03 +00:00
**Current** column is empty.
2021-07-09 01:34:24 +00:00
- `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.
2020-06-03 21:32:39 +00:00
Plugins using the old plugin format can still be consumed.
2021-07-09 01:34:24 +00:00
- `pub run` : Fix precompilation with relative `PUB_CACHE` paths
2020-07-17 23:58:03 +00:00
([#2486](https://github.com/dart-lang/pub/pull/2486)).
2021-07-09 01:34:24 +00:00
- Preserve Windows line endings in `pubspec.lock` if they are already there
2020-07-17 23:58:03 +00:00
([#2489](https://github.com/dart-lang/pub/pull/2489)).
2021-07-09 01:34:24 +00:00
- 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.
2020-05-20 13:06:02 +00:00
2020-06-03 10:12:02 +00:00
## 2.8.4 - 2020-06-04
This is a patch release that fixes potential memory leaks in the Dart front-end
(issues [#42111][] and [#42112][]).
[#42111]: https://github.com/dart-lang/sdk/issues/42111
[#42112]: https://github.com/dart-lang/sdk/issues/42112
2020-05-26 16:28:11 +00:00
## 2.8.3 - 2020-05-28
This is a patch release that fixes the following issues:
2021-07-09 01:34:24 +00:00
- 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][]).
2020-05-26 16:28:11 +00:00
[flutter/flutter#57318]: https://github.com/flutter/flutter/issues/57318
[#41907]: https://github.com/dart-lang/sdk/issues/41907
[flutter/flutter#57190]: https://github.com/flutter/flutter/issues/57190
2020-05-11 09:49:26 +00:00
## 2.8.2 - 2020-05-13
This is a patch release that fixes an AOT compilation bug in global
2021-07-09 01:34:24 +00:00
transformations which manifests as a NoSuchMethod exception (issue
[flutter/flutter#56479][]).
2020-05-11 09:49:26 +00:00
[flutter/flutter#56479]: https://github.com/flutter/flutter/issues/56479
2020-04-21 14:28:53 +00:00
2020-04-30 06:54:58 +00:00
## 2.8.1 - 2020-05-06
2020-03-25 18:24:02 +00:00
Much of the changes in this release are in preparation for non-nullable types,
which will arrive in a future version. In anticipation of that, we have made a
number of small but technically breaking changes to several core library APIs in
order to make them easier to use in a world with non-nullable types. Almost all
existing Dart code will be unaffected by these changes, but if you see
unexpected failures, note the breaking changes listed below.
2019-06-06 19:49:07 +00:00
2019-11-12 18:19:44 +00:00
### Language
2021-07-09 01:34:24 +00:00
There are no new language features in this release. There are only two minor
breaking changes:
2020-03-27 00:18:42 +00:00
2021-07-09 01:34:24 +00:00
- **Breaking change** [#40675][]: Fixed an implementation bug where local
variable inference would incorrectly use the promoted type of a type variable.
2020-03-27 00:18:42 +00:00
2021-07-09 01:34:24 +00:00
- **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.
2020-04-14 05:35:09 +00:00
2020-03-27 00:18:42 +00:00
[#40675]: https://github.com/dart-lang/sdk/issues/40675
2020-04-14 05:35:09 +00:00
[#41362]: https://github.com/dart-lang/sdk/issues/41362
2020-03-25 18:24:02 +00:00
2019-12-06 15:13:28 +00:00
### Core libraries
2020-03-19 23:31:30 +00:00
#### `dart:async`
2021-07-09 01:34:24 +00:00
- **Breaking change** [#40676][]: Changed the return type of
`StreamSubscription.cancel()` to `Future<void>` . Previously, it was declared
to return `Future` and was allowed to return `null` at runtime.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- **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.
2020-03-19 23:31:30 +00:00
2021-07-09 01:34:24 +00:00
- **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.
2020-03-27 00:18:42 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2020-03-27 00:18:42 +00:00
2021-07-09 01:34:24 +00:00
Error handling functions need no longer be prepared for `null` stack traces.
2020-03-27 00:18:42 +00:00
[#40676]: https://github.com/dart-lang/sdk/issues/40676
2020-03-25 18:24:02 +00:00
[#40681]: https://github.com/dart-lang/sdk/issues/40681
2020-03-27 00:18:42 +00:00
[#40683]: https://github.com/dart-lang/sdk/issues/40683
[#40130]: https://github.com/dart-lang/sdk/issues/40130
2020-03-25 00:24:33 +00:00
2020-02-21 14:02:57 +00:00
#### `dart:core`
2021-07-09 01:34:24 +00:00
- **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.
2020-03-27 00:18:42 +00:00
2021-07-09 01:34:24 +00:00
- **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.
2020-03-27 00:18:42 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2020-03-25 19:41:03 +00:00
2021-07-09 01:34:24 +00:00
- Adds `StackTrace.empty` constant which is the stack trace used as default
stack trace when no better alternative is available.
2020-03-19 23:31:30 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- `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.
2020-02-21 14:02:57 +00:00
2020-03-27 00:18:42 +00:00
[#40674]: https://github.com/dart-lang/sdk/issues/40674
[#40678]: https://github.com/dart-lang/sdk/issues/40678
2020-03-25 19:41:03 +00:00
[40763]: https://github.com/dart-lang/sdk/issues/40763
2020-03-16 18:04:58 +00:00
#### `dart:developer`
2021-07-09 01:34:24 +00:00
- 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.
2020-03-16 18:04:58 +00:00
2022-04-05 14:57:53 +00:00
#### `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:
```dart
import 'dart:ffi';
```
2019-12-17 19:17:30 +00:00
#### `dart:html`
2022-02-09 13:41:52 +00:00
- **Breaking change** [#39627][]: Changed the return type of several HTML native
2021-07-09 01:34:24 +00:00
methods involving futures. In return types that matched `Future<List<T>>` ,
`T was` changed to `dynamic` . These methods would have resulted in a runtime
error if they were used.
2019-12-17 19:17:30 +00:00
2022-02-09 13:41:52 +00:00
- **Breaking change**: `Node.insertAllBefore()` erroneously had a return type of
2021-07-09 01:34:24 +00:00
`Node` , even though it was not returning anything. This has been corrected to
`void` .
2019-12-17 19:17:30 +00:00
2020-03-25 18:24:02 +00:00
[#39627]: https://github.com/dart-lang/sdk/issues/39627
2020-02-19 20:43:34 +00:00
2019-12-06 15:13:28 +00:00
#### `dart:io`
2021-07-09 01:34:24 +00:00
- 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.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- **Breaking change** [#33501][]: The signature of `HttpHeaders` methods `add()`
and `set` have been changed to:
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
```dart
void add(String name, Object value, {bool preserveHeaderCase: false})
void set(String name, Object value, {bool preserveHeaderCase: false})
```
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
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.
- **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** [#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.
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"}` .
- 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:
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
```dart
HeaderValue("v",
{"a": "A", "b": "(B)", "c": "", "d": "ø", "e": "\\\""}).toString()
```
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
Gives: `v;a=A;b="(B)";c="";d="ø";e="\\\""` .
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- [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.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- Class `InternetAddressType` gains one more option `Unix` , which represents a
Unix domain address.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- Class `InternetAddress` :
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- `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.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- `InternetAddress` gains a new constructor `fromRawAddress()` that takes an
address in byte format for Internet addresses or raw file path for Unix
domain addresses.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- **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.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- Class `HttpClient` and `HttpServer` , when receiving `HttpRequest` or
`HttpClientResponse` , will now put a 8K size limit on its header fields and
values.
2020-05-13 21:29:17 +00:00
2020-03-25 18:24:02 +00:00
[#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
2021-07-09 01:34:24 +00:00
[rfc 7230 tokens]: https://tools.ietf.org/html/rfc7230#section-3.2.6
[unix domain sockets]: https://en.wikipedia.org/wiki/Unix_domain_socket
2020-03-25 00:24:33 +00:00
2020-02-07 20:57:46 +00:00
#### `dart:mirrors`
2021-07-09 01:34:24 +00:00
- Added `MirrorSystem.neverType` .
2020-02-07 20:57:46 +00:00
2019-12-06 15:13:28 +00:00
### Dart VM
2021-07-09 01:34:24 +00:00
- Added `Dart_TypeDynamic` , `Dart_TypeVoid` and `Dart_TypeNever` . Type `dynamic`
can no longer by reached using `Dart_GetType(dart:core, dynamic)` .
2020-01-31 18:33:02 +00:00
2021-07-09 01:34:24 +00:00
- Added the following methods to the VM embedding API:
2019-12-06 15:13:28 +00:00
2021-07-09 01:34:24 +00:00
- `Dart_GetNonNullableType()`
- `Dart_GetNullableType()`
- `Dart_TypeToNonNullable()`
- `Dart_TypeToNullable()`
- `Dart_IsLegacyType()`
- `Dart_IsNonNullableType()`
- `Dart_IsNullableType()`
2020-02-26 20:34:31 +00:00
2020-03-25 18:24:02 +00:00
### Tools
2020-03-20 12:54:32 +00:00
2020-03-25 18:24:02 +00:00
#### Dart Dev Compiler (DDC)
2020-01-16 14:45:59 +00:00
2020-03-25 18:24:02 +00:00
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.
2019-12-13 08:06:28 +00:00
2022-02-09 13:41:52 +00:00
- **Breaking change**: Deleted the legacy (analyzer based) version of DDC. For
2021-07-09 01:34:24 +00:00
additional details see the [announcement][ddc].
2020-01-16 14:45:59 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2020-01-16 14:45:59 +00:00
2021-07-09 01:34:24 +00:00
- Command line arguments that were only used for the legacy DDC have been
removed.
2020-03-20 12:54:32 +00:00
2021-07-09 01:34:24 +00:00
- 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` .
2020-03-20 12:54:32 +00:00
2022-02-09 13:41:52 +00:00
- **Breaking change**: Functions passed to JavaScript using the recommended
2021-07-09 01:34:24 +00:00
`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.
2020-01-16 14:45:59 +00:00
2022-02-09 13:41:52 +00:00
- **Breaking change**: Constructors in `@JS()` classes must be marked with
2021-07-09 01:34:24 +00:00
`external` . Previously the `external` could be omitted in some cases with DDC
but doing so would cause incorrect behavior with Dart2JS.
2020-01-16 14:45:59 +00:00
2021-07-09 01:34:24 +00:00
- JS interop classes with an index operator are now static errors.
2020-01-16 14:45:59 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2020-01-16 14:45:59 +00:00
2021-07-09 01:34:24 +00:00
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.
2020-03-24 13:45:19 +00:00
2020-03-25 18:24:02 +00:00
[ddc]: https://github.com/dart-lang/sdk/issues/38994
2020-03-24 13:45:19 +00:00
2020-03-25 18:24:02 +00:00
#### Dart2JS
2020-01-04 00:44:25 +00:00
2020-03-25 18:24:02 +00:00
A new representation of runtime types is enabled by default.
2020-01-04 00:44:25 +00:00
This change is part of a long term goal of making runtime checks cheaper and
more flexible for upcoming changes in the language. The new representation
disentangles how types and classes are represented and makes types first-class
2020-03-25 18:24:02 +00:00
to the compiler. This makes it possible to do certain kind of optimizations on
2020-01-04 00:44:25 +00:00
type checks that were not possible before and will enable us to model
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:
2021-07-09 01:34:24 +00:00
- Types are now canonicalized, this fixes a long standing bug that Types could
not be used in switch cases (issue [17207][]).
2020-01-04 00:44:25 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2020-01-04 00:44:25 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2020-01-04 00:44:25 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2020-01-04 00:44:25 +00:00
2021-07-09 01:34:24 +00:00
- `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<T>` , then it
compiles expressions like `foo.runtimeType.toString()` to print `Foo` . With
the new representation, this will show `Foo<erased>` instead. This change may
be visible in error messages produced by type checks involving erased types.
2020-01-04 00:44:25 +00:00
Because types and classes are represented separately, we will likely reevaluate
restrictions of deferred libraries in the near future. For example, we could
support referring to deferred types because types can be downloaded while
classes are not.
In the unlikely case you run into any issues, please file a bug so we can
investigate. You can temporarily force the old type representation by passing
2020-03-25 18:24:02 +00:00
`--use-old-rti` to Dart2JS if necessary, but our goal is to delete the old type
2020-01-04 00:44:25 +00:00
representation soon.
2020-03-25 18:24:02 +00:00
In addition, we fixed some inconsistencies between Dart2JS and DDC:
2021-07-09 01:34:24 +00:00
- JS interop classes with an index operator are now static errors instead of
causing invalid code in Dart2JS.
2020-03-25 18:24:02 +00:00
2022-02-09 13:41:52 +00:00
- **Breaking change**: The subtyping rule for generic functions is now more
2021-07-09 01:34:24 +00:00
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.
2020-03-25 18:24:02 +00:00
2022-02-09 13:41:52 +00:00
- **Breaking change**: Types are now normalized. See [normalization][] for the
2021-07-09 01:34:24 +00:00
full specification. Types will now be printed in their normal form, and mutual
subtypes with the same normal form will now be considered equal.
2020-03-25 18:24:02 +00:00
2022-02-09 13:41:52 +00:00
- **Breaking change**: Constructors in `@JS()` classes must be marked with
2021-07-09 01:34:24 +00:00
`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.
2020-01-04 00:44:25 +00:00
[17207]: https://github.com/dart-lang/sdk/issues/17207
2021-07-09 01:34:24 +00:00
[normalization]:
https://github.com/dart-lang/language/blob/master/resources/type-system/normalization.md
2020-03-26 17:28:24 +00:00
Other dart2js changes:
2022-02-09 13:41:52 +00:00
- **Breaking change**: The `--package-root` flag, which was hidden and disabled
2020-03-26 17:28:24 +00:00
in Dart 2.0.0, has been completely removed. Passing this flag will now cause
`dart2js` to fail.
2020-03-25 18:24:02 +00:00
#### Linter
2020-04-14 14:09:56 +00:00
Updated the Linter to `0.1.114` , which includes:
2021-07-09 01:34:24 +00:00
- 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 (`_`).
2020-03-25 18:24:02 +00:00
#### Analyzer
2021-07-09 01:34:24 +00:00
- Removed support for the deprecated analysis options file name
`.analysis_options` .
2020-03-25 18:24:02 +00:00
#### Pub
2021-07-09 01:34:24 +00:00
- Added `pub outdated` command which lists outdated package dependencies, and
gives advice on how to upgrade.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- `pub get` and `pub upgrade` now fetch version information about hosted
dependencies in parallel, improving the time package resolution performance.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- `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.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- Fixed missing retries of DNS failures during `pub get` .
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- If code contains imports for packages not listed in the package's
`pubspec.yaml` then `pub publish` will reject the package.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- `pub publish` no longer requires the presence of a `homepage` field, if the
`repository` field is provided.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- `pub publish` warns if non-pre-release packages depends on pre-release
packages or pre-release Dart SDKs.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- Relative paths in `pubspec.lock` now use `/` also on Windows to make the file
sharable between machines.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- `%LOCALAPPDATA%` is now preferred over `%APPDATA%` when creating a pub cache
directory on Windows. `%LOCALAPPDATA%` is not copied when users roam between
devices.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- `pub publish` warns if LICENSE and README.md files are not called those exact
names.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
- `pub repair cache` downloads hosted packages in parallel.
2020-03-25 18:24:02 +00:00
2021-07-09 01:34:24 +00:00
[package config]:
https://github.com/dart-lang/language/blob/master/accepted/future-releases/language-versioning/package-config-file-v2.md
2020-03-25 18:24:02 +00:00
2020-03-23 20:21:54 +00:00
## 2.7.2 - 2020-03-23
2020-03-13 14:09:52 +00:00
2022-02-09 13:41:52 +00:00
**Security advisory**: This is a patch release that addresses a vulnerability in
`dart:html` [NodeValidator][] related to DOM clobbering of `previousSibling` .
See the security advisory [CVE-2020-8923][cve-2020-8923] for more details.
Thanks to **Vincenzo di Cicco** for finding and reporting this issue.
2020-03-23 20:21:54 +00:00
2020-03-25 18:24:02 +00:00
This release also improves compatibility with ARMv8 processors (issue [40001][])
and dart:io stability (issue [40589][]).
2020-03-13 14:09:52 +00:00
2021-07-09 01:34:24 +00:00
[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
2020-03-13 14:09:52 +00:00
[40001]: https://github.com/dart-lang/sdk/issues/40001
[40589]: https://github.com/dart-lang/sdk/issues/40589
2020-01-24 13:18:07 +00:00
## 2.7.1 - 2020-01-23
2020-01-23 11:53:55 +00:00
This is a patch release that improves dart2js compile-time (issue [40217][]).
[40217]: https://github.com/dart-lang/sdk/issues/40217
2022-02-09 13:41:52 +00:00
**Breaking change**: The Dart SDK for macOS is now only available for x64 (issue
2021-07-09 01:34:24 +00:00
[39810][]).
2020-01-23 11:53:55 +00:00
[39810]: https://github.com/dart-lang/sdk/issues/39810
2019-12-06 15:13:28 +00:00
## 2.7.0 - 2019-12-11
2019-12-11 09:44:24 +00:00
**Extension methods** -- which we shipped in preview in 2.6.0 -- are no longer
in preview, and are now officially supported as of 2.7.0. Learn more about them
here:
https://medium.com/dartlang/extension-methods-2d466cd8b308
2019-12-06 15:13:28 +00:00
### Language
2022-02-09 13:41:52 +00:00
- **Breaking change**: [Static extension members][] are accessible when imported
2021-07-09 01:34:24 +00:00
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 {
2019-11-12 18:19:44 +00:00
}
2021-07-09 01:34:24 +00:00
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
2019-11-12 18:19:44 +00:00
[671]: https://github.com/dart-lang/language/issues/671
2019-11-05 15:11:02 +00:00
### Core libraries
#### `dart:io`
2021-07-09 01:34:24 +00:00
- **Breaking change**: Added `IOOverrides.serverSocketBind` to aid in writing
2019-11-05 15:11:02 +00:00
tests that wish to mock `ServerSocket.bind` .
2020-01-22 14:39:48 +00:00
#### `dart:typed_data`
2021-07-09 01:34:24 +00:00
- 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.
2020-01-22 14:39:48 +00:00
2019-11-05 15:11:02 +00:00
### Dart VM
2021-07-09 01:34:24 +00:00
- New fields added to existing instances by a reload will now be initialized
2019-12-10 02:17:04 +00:00
lazily, as if the field was a late field. This makes the initialization order
program-defined, whereas previously it was undefined.
2019-11-05 15:11:02 +00:00
### Tools
#### Linter
2019-12-06 15:13:28 +00:00
The Linter was updated to `0.1.104` , which includes:
2019-11-05 15:11:02 +00:00
2021-07-09 01:34:24 +00:00
- 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`
2019-11-05 15:11:02 +00:00
#### Pub
2021-07-09 01:34:24 +00:00
- `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 )
2019-11-05 15:11:02 +00:00
in addition to `.packages` to support language versioning.
2021-07-09 01:34:24 +00:00
- `pub publish` now warns about the old flutter plugin registration format.
2019-11-05 15:11:02 +00:00
2021-07-09 01:34:24 +00:00
- `pub publish` now warns about the `author` field in pubspec.yaml being.
2019-11-05 15:11:02 +00:00
obsolete.
2021-07-09 01:34:24 +00:00
- Show a proper error message when `git` is not installed.
2019-11-05 15:11:02 +00:00
2019-11-11 11:52:13 +00:00
## 2.6.1 - 2019-11-11
This is a patch release that reduces dart2js memory usage (issue [27883][]),
improves stability on arm64 (issue [39090][]) and updates the Dart FFI
documentation.
[27883]: https://github.com/dart-lang/sdk/issues/27883
[39090]: https://github.com/dart-lang/sdk/issues/39090
2019-11-05 15:11:02 +00:00
## 2.6.0 - 2019-11-05
2019-06-13 18:31:05 +00:00
### Language
2021-07-09 01:34:24 +00:00
- **[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.
2019-12-10 02:17:04 +00:00
2021-07-09 01:34:24 +00:00
Static extension members are declared using a new `extension` declaration.
Example:
2019-12-10 02:17:04 +00:00
2021-07-09 01:34:24 +00:00
```dart
extension MyFancyList< T > on List< T > {
/// Whether this list has an even length.
bool get isLengthEven => this.length.isEven;
/// 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< R > combinePairs< R > (R Function(T, T) combine) =>
[for (int i = 1; i < this.length ; i + + )
combine(this[i - 1], this[i])];
}
```
2019-10-04 08:27:54 +00:00
2021-07-09 01:34:24 +00:00
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<T>` "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.
2019-12-10 02:17:04 +00:00
2021-07-09 01:34:24 +00:00
Extensions can be declared on any type, not just interface types.
2019-10-04 08:27:54 +00:00
2021-07-09 01:34:24 +00:00
```dart
extension IntCounter on int {
/// The numbers from this number to, but not including, [end].
Iterable< int > to(int end) sync* {
int step = end < this ? -1 : 1 ;
for (int i = this; i != end; i += step) yield i;
2019-10-04 08:27:54 +00:00
}
2021-07-09 01:34:24 +00:00
}
2019-12-10 02:17:04 +00:00
2021-07-09 01:34:24 +00:00
extension CurryFunction< R , S , T > on R Function(S, T) {
/// Curry a binary function with its first argument.
R Function(T) curry(S first) => (T second) => this(first, second);
}
```
2019-10-04 08:27:54 +00:00
2021-07-09 01:34:24 +00:00
[static extension members]:
https://github.com/dart-lang/language/blob/master/accepted/2.6/static-extension-members/feature-specification.md
2019-09-12 07:37:17 +00:00
2021-07-09 01:34:24 +00:00
- **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<T>` 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):
2019-12-10 02:17:04 +00:00
2021-07-09 01:34:24 +00:00
```dart
import 'dart:async';
2019-12-10 02:17:04 +00:00
2021-07-09 01:34:24 +00:00
void foo< T > (FutureOr< T > Function() f) { print(T); }
2019-09-12 07:37:17 +00:00
2021-07-09 01:34:24 +00:00
main() { foo(() {}); }
```
2019-09-12 07:37:17 +00:00
2019-09-10 11:28:13 +00:00
### Core libraries
2021-07-09 01:34:24 +00:00
- Default values of parameters of abstract methods are no longer available via
`dart:mirrors` .
2019-09-18 20:12:50 +00:00
2019-10-03 16:33:38 +00:00
#### `dart:developer`
2021-07-09 01:34:24 +00:00
- Added optional `parent` parameter to `TimelineTask` constructor to allow for
2019-10-03 16:33:38 +00:00
linking of asynchronous timeline events in the DevTools timeline view.
2022-04-05 14:57:53 +00:00
#### `dart:ffi`
2019-10-18 19:20:43 +00:00
2021-07-09 01:34:24 +00:00
- **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.
2019-10-11 14:21:04 +00:00
2022-04-05 14:57:53 +00:00
#### `dart:io`
- 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.
2019-10-05 00:27:22 +00:00
### Dart for the Web
#### Dart Dev Compiler (DDC)
2021-07-09 01:34:24 +00:00
- Kernel DDC will no longer accept non-dill files as summary inputs.
- Removed support for the deprecated web extension.
2019-10-05 00:27:22 +00:00
2019-09-10 11:28:13 +00:00
### Tools
#### Linter
2019-11-05 15:11:02 +00:00
The Linter was updated to `0.1.101` , which includes:
2019-10-01 14:31:57 +00:00
2021-07-09 01:34:24 +00:00
- 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
2019-09-10 11:28:13 +00:00
2020-04-23 15:40:02 +00:00
## 2.5.2 - 2019-10-08
This is a patch release with properly signed binaries required for macOS
Catalina (Issue [38765][]).
[38765]: https://github.com/dart-lang/sdk/issues/38765
2019-09-30 11:32:25 +00:00
## 2.5.1 - 2019-09-27
This is a patch release that prevents type inference failures in the analyzer
(Issue [38365][]).
[38365]: https://github.com/dart-lang/sdk/issues/38365
2019-09-10 11:28:13 +00:00
## 2.5.0 - 2019-09-10
### Language
2019-08-16 21:40:47 +00:00
The set of operations allowed in constant expressions has been expanded as
2021-07-09 01:34:24 +00:00
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
2019-08-16 21:40:47 +00:00
[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:
2021-07-09 01:34:24 +00:00
- 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.
2019-08-16 21:40:47 +00:00
```dart
// Example: these are now valid constants.
2019-09-04 07:58:23 +00:00
const Object i = 3;
2019-08-16 21:40:47 +00:00
const list = [i as int];
const set = {if (list is List< int > ) ...list};
const map = {if (i is int) i : "int"};
```
In addition, the semantics of constant evaluation has been changed as follows:
2021-07-09 01:34:24 +00:00
- 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.
2019-08-16 21:40:47 +00:00
```dart
// Example: x is now a valid constant definition.
const String s = null;
const int x = (s == null) ? 0 : s.length;
```
2019-06-11 12:46:43 +00:00
### Core libraries
2019-06-06 19:49:07 +00:00
2021-07-09 01:34:24 +00:00
- **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<int>` , were updated to declare a return type
of `Uint8List` :
- `BytesBuilder.takeBytes()`
- `BytesBuilder.toBytes()`
- `Datagram.data`
- `File.readAsBytes()` (`Future< Uint8List > `)
- `File.readAsBytesSync()`
- `InternetAddress.rawAddress`
- `RandomAccessFile.read()` (`Future< Uint8List > `)
- `RandomAccessFile.readSync()`
- `RawSocket.read()`
- `Utf8Codec.encode()` (and `Utf8Encoder.convert()` )
2019-06-27 00:21:07 +00:00
2019-07-16 06:05:11 +00:00
In addition, the following classes were updated to implement
`Stream<Uint8List>` rather than `Stream<List<int>>` :
2019-06-20 06:43:44 +00:00
2021-07-09 01:34:24 +00:00
- `HttpRequest`
- `Socket`
2019-07-08 16:42:47 +00:00
**Possible errors and how to fix them**
2021-07-09 01:34:24 +00:00
- > The argument type 'Utf8Decoder' can't be assigned to the parameter type
> 'StreamTransformer<Uint8List, dynamic>'
2019-07-08 16:42:47 +00:00
2021-07-09 01:34:24 +00:00
> type 'Utf8Decoder' is not a subtype of type 'StreamTransformer' of
> 'streamTransformer'"
2019-07-08 16:42:47 +00:00
2021-07-09 01:34:24 +00:00
You can fix these call sites by updating your code to use
`StreamTransformer.bind()` instead of `Stream.transform()` , like so:
2019-07-08 16:42:47 +00:00
2021-07-09 01:34:24 +00:00
_Before:_ `stream.transform(utf8.decoder)` _After:_
`utf8.decoder.bind(stream)`
2019-07-08 16:42:47 +00:00
2021-07-09 01:34:24 +00:00
- > The argument type 'IOSink' can't be assigned to the parameter type
> 'StreamConsumer<Uint8List>'
2019-07-08 16:42:47 +00:00
2021-07-09 01:34:24 +00:00
> type '\_IOSinkImpl' is not a subtype of type 'StreamConsumer<Uint8List>'
> of 'streamConsumer'
2019-07-08 16:42:47 +00:00
2021-07-09 01:34:24 +00:00
You can fix these call sites by casting your stream instance to a
`Stream<List<int>>` before calling `.pipe()` on the stream, like so:
2019-07-08 16:42:47 +00:00
2021-07-09 01:34:24 +00:00
_Before:_ `stream.pipe(consumer)` _After:_
`stream.cast<List<int>>().pipe(consumer)`
2019-06-27 00:21:07 +00:00
Finally, the following typed lists were updated to have their `sublist()`
2019-06-20 06:43:44 +00:00
methods declare a return type that is the same as the source list:
2021-07-09 01:34:24 +00:00
- `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`
2019-06-20 06:43:44 +00:00
2019-07-08 13:38:54 +00:00
#### `dart:async`
2021-07-09 01:34:24 +00:00
- Add `value` and `error` constructors on `Stream` to allow easily creating
single-value or single-error streams.
2019-07-08 13:38:54 +00:00
2019-06-13 18:31:05 +00:00
#### `dart:core`
2019-06-06 19:49:07 +00:00
2021-07-09 01:34:24 +00:00
- Update `Uri` class to support [RFC6874 ](https://tools.ietf.org/html/rfc6874 ):
2019-06-13 18:31:05 +00:00
"%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
2021-07-09 01:34:24 +00:00
encoded octet, which was defined in RFC3986. IPv6addrz = IPv6address "%25"
ZoneID
2019-06-06 19:49:07 +00:00
2019-06-13 18:31:05 +00:00
[29456]: https://github.com/dart-lang/sdk/issues/29456
2019-06-11 12:46:43 +00:00
2019-06-20 13:40:10 +00:00
#### `dart:io`
2021-07-09 01:34:24 +00:00
- **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:
2019-06-20 13:40:10 +00:00
Cookie([String name, String value])
to
Cookie(String name, String value)
However, it has not been possible to set `name` and `value` to null since Dart
1.3.0 (2014) where a bug made it impossible. Any code not using both
parameters or setting any to null would necessarily get a noSuchMethod
exception at runtime. This change catches such erroneous uses at compile time.
Since code could not previously correctly omit the parameters, this is not
really a breaking change.
2021-07-09 01:34:24 +00:00
- **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.
2019-06-20 13:40:10 +00:00
2019-06-13 18:31:05 +00:00
### Dart VM
2019-06-11 12:46:43 +00:00
2019-06-13 18:31:05 +00:00
### Tools
2019-06-11 12:46:43 +00:00
2019-07-03 09:24:24 +00:00
#### Pub
2021-07-09 01:34:24 +00:00
- 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.
2019-07-03 09:24:24 +00:00
2019-06-25 21:56:44 +00:00
#### Linter
2019-09-10 11:28:13 +00:00
The Linter was updated to `0.1.96` , which includes:
2019-08-30 14:38:15 +00:00
2021-07-09 01:34:24 +00:00
- fixed false positives in `unnecessary_parens`
- various changes to migrate to preferred analyzer APIs
- rule test fixes
2019-06-25 21:56:44 +00:00
2019-07-10 20:36:09 +00:00
#### Dartdoc
2021-07-09 01:34:24 +00:00
Dartdoc was updated to `0.28.4` ; this version includes several fixes and is
based on a newer version of the analyzer package.
2019-07-10 20:36:09 +00:00
2019-08-07 10:01:30 +00:00
## 2.4.1 - 2019-08-07
2021-07-09 01:34:24 +00:00
This is a patch release that fixes a performance regression in JIT mode, as well
as a potential crash of our AOT compiler.
2019-08-07 10:01:30 +00:00
### Dart VM
2021-07-09 01:34:24 +00:00
- Fixed a performance regression where usage of `Int32List` could trigger
2019-08-08 18:21:29 +00:00
repeated deoptimizations in JIT mode (Issue [37551][]).
2019-08-07 10:01:30 +00:00
2021-07-09 01:34:24 +00:00
- Fixed a bug where usage of a static getter with name `length` could cause a
2019-08-08 18:21:29 +00:00
crash in our AOT compiler (Issue [35121][]).
2019-08-07 10:01:30 +00:00
[37551]: https://github.com/dart-lang/sdk/issues/37551
[35121]: https://github.com/dart-lang/sdk/issues/35121
2019-09-07 01:30:05 +00:00
### Dart Dev Compiler (DDC)
Callbacks passed to JS and wrapped with `allowInterop` or
`allowInteropCaptureThis` are now strict about argument counts and argument
types. This may mean that tests which were previously passing and relying on
loose argument checking (too many or too few arguments, or arguments with too
specific types like `List<Something>` instead of `List<dynamic>` ) may start
failing. This changes makes DDC behave more like dart2js with the default flags.
2019-06-27 14:08:00 +00:00
## 2.4.0 - 2019-06-27
2019-04-29 09:11:48 +00:00
2019-06-13 18:31:05 +00:00
### Core libraries
2019-05-21 18:37:58 +00:00
2019-06-13 18:31:05 +00:00
#### `dart:isolate`
2019-05-29 22:53:47 +00:00
2021-07-09 01:34:24 +00:00
- `TransferableTypedData` class was added to facilitate faster cross-isolate
communication of `Uint8List` data.
2019-05-29 22:53:47 +00:00
2021-07-09 01:34:24 +00:00
- **Breaking change**: `Isolate.resolvePackageUri` will always throw an
2019-06-13 18:31:05 +00:00
`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
throws in dart2js if the API is used directly without manually setting up a
`defaultPackagesBase` hook.
2019-05-24 08:21:14 +00:00
2021-09-15 06:22:23 +00:00
[1]: https://github.com/dart-lang/sdk/blob/main/CHANGELOG.md#200---2018-08-07
2019-05-29 22:53:47 +00:00
2019-05-28 18:02:12 +00:00
#### `dart:developer`
2021-07-09 01:34:24 +00:00
- Exposed `result` , `errorCode` and `errorDetail` getters in
2019-05-28 18:02:12 +00:00
`ServiceExtensionResponse` to allow for better debugging of VM service
extension RPC results.
2019-05-21 18:37:58 +00:00
2019-05-23 10:05:36 +00:00
#### `dart:io`
2021-07-09 01:34:24 +00:00
- Fixed `Cookie` class interoperability with certain websites by allowing the
2019-05-23 10:05:36 +00:00
cookie values to be the empty string (Issue [35804][]) and not stripping
double quotes from the value (Issue [33327][]) in accordance with RFC 6265.
2019-05-30 21:57:35 +00:00
[33327]: https://github.com/dart-lang/sdk/issues/33327
[35804]: https://github.com/dart-lang/sdk/issues/35804
2021-07-09 01:34:24 +00:00
- [#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` .
2019-05-31 16:30:24 +00:00
As part of this change, a corresponding new enum was added to `dart:io` :
`HttpClientResponseCompressionState` .
2019-07-23 15:10:53 +00:00
This is a **breaking change** for those implementing the `HttpClientResponse`
interface as subclasses will need to implement the new getter.
2019-05-23 10:05:36 +00:00
2019-04-30 13:27:48 +00:00
#### `dart:async`
2019-06-13 18:31:05 +00:00
2021-07-09 01:34:24 +00:00
- **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.
2019-04-30 13:27:48 +00:00
2019-04-29 09:11:48 +00:00
#### `dart:core`
2021-07-09 01:34:24 +00:00
- [#36171 ](https://github.com/dart-lang/sdk/issues/36171 ): The `RegExp`
interface has been extended with two new constructor named parameters:
2019-04-29 09:11:48 +00:00
2021-07-09 01:34:24 +00:00
- `unicode:` (`bool`, default: `false` ), for Unicode patterns
- `dotAll:` (`bool`, default: `false` ), to change the matching behavior of '.'
to also match line terminating characters.
2019-04-29 09:11:48 +00:00
Appropriate properties for these named parameters have also been added so
their use can be detected after construction.
2021-07-09 01:34:24 +00:00
In addition, `RegExp` methods that originally returned `Match` objects now
return a more specific subtype, `RegExpMatch` , which adds two features:
2019-04-29 09:11:48 +00:00
2021-07-09 01:34:24 +00:00
- `Iterable<String> groupNames` , a property that contains the names of all
2019-05-21 18:37:58 +00:00
named capture groups
2021-07-09 01:34:24 +00:00
- `String namedGroup(String name)` , a method that retrieves the match for the
given named capture group
2019-04-29 09:11:48 +00:00
2019-07-23 15:10:53 +00:00
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
return types on overridden methods.
2019-04-29 09:11:48 +00:00
2019-06-13 18:31:05 +00:00
### Language
2019-04-30 13:27:48 +00:00
2021-07-09 01:34:24 +00:00
- **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:
2019-06-13 18:31:05 +00:00
```dart
class A< X > {};
class B< X > extends A< void Function ( X ) > {};
```
2021-07-09 01:34:24 +00:00
- The identifier `async` can now be used in asynchronous and generator
2019-06-13 18:31:05 +00:00
functions.
2019-06-13 22:48:57 +00:00
### Dart for the Web
#### Dart Dev Compiler (DDC)
2021-07-09 01:34:24 +00:00
- Improve `NoSuchMethod` errors for failing dynamic calls. Now they include
2019-06-13 22:48:57 +00:00
specific information about the nature of the error such as:
2021-07-09 01:34:24 +00:00
- 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.
2019-06-13 22:48:57 +00:00
2019-06-13 18:31:05 +00:00
### Tools
#### Linter
The Linter was updated to `0.1.91` , which includes the following changes:
2021-07-09 01:34:24 +00:00
- 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
2019-06-13 18:31:05 +00:00
#### Pub
2021-07-09 01:34:24 +00:00
- `pub publish` will no longer warn about missing dependencies for import
statements in `example/` .
- OAuth2 authentication will explicitly ask for the `openid` scope.
2019-04-30 13:27:48 +00:00
2019-06-11 14:17:40 +00:00
## 2.3.2 - 2019-06-11
This is a patch version release with a security improvement.
### Security vulnerability
2021-07-09 01:34:24 +00:00
- **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.
2019-06-11 14:17:40 +00:00
2021-07-09 01:34:24 +00:00
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:
2019-06-11 14:17:40 +00:00
2021-07-09 01:34:24 +00:00
```dart
Process.run("ls", workingDirectory: "/untrusted/directory")
```
2019-06-11 14:17:40 +00:00
2021-07-09 01:34:24 +00:00
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.
2019-06-11 14:17:40 +00:00
2021-07-09 01:34:24 +00:00
This vulnerability was introduced in Dart 2.0.0.
2019-06-11 14:17:40 +00:00
[37101]: https://github.com/dart-lang/sdk/issues/37101
2019-05-21 18:37:58 +00:00
## 2.3.1 - 2019-05-21
This is a patch version release with bug fixes.
2019-05-09 17:34:21 +00:00
### Tools
2019-05-21 18:37:58 +00:00
#### dart2js
2019-05-09 17:34:21 +00:00
2021-07-09 01:34:24 +00:00
- Fixed a bug that caused the compiler to crash when it compiled UI-as-code
2019-05-21 18:37:58 +00:00
features within fields (Issue [36864][]).
2019-05-09 17:34:21 +00:00
2019-05-21 18:37:58 +00:00
[36864]: https://github.com/dart-lang/sdk/issues/36864
2019-05-09 17:34:21 +00:00
2019-05-21 18:37:58 +00:00
## 2.3.0 - 2019-05-08
2019-04-18 21:27:51 +00:00
The focus in this release is on the new "UI-as-code" language features which
make collections more expressive and declarative.
2019-02-26 17:23:13 +00:00
### Language
2019-04-18 21:27:51 +00:00
Flutter is growing rapidly, which means many Dart users are building UI in code
out of big deeply-nested expressions. Our goal with 2.3.0 was to [make that kind
of code easier to write and maintain][ui-as-code]. Collection literals are a
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.
2019-02-26 17:23:13 +00:00
2021-07-09 01:34:24 +00:00
[ui-as-code]:
https://medium.com/dartlang/making-dart-a-better-language-for-ui-f1ccaf9f546c
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
#### Spread
2019-04-09 22:57:29 +00:00
2019-04-18 21:27:51 +00:00
Placing `...` before an expression inside a collection literal unpacks the
result of the expression and inserts its elements directly inside the new
collection. Where before you had to write something like this:
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
```dart
CupertinoPageScaffold(
child: ListView(children: [
Tab2Header()
]..addAll(buildTab2Conversation())
..add(buildFooter())),
);
```
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
Now you can write this:
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
```dart
CupertinoPageScaffold(
child: ListView(children: [
Tab2Header(),
...buildTab2Conversation(),
buildFooter()
]),
);
```
2019-04-08 07:14:19 +00:00
2019-04-19 17:39:30 +00:00
If you know the expression might evaluate to null and you want to treat that as
2019-04-23 19:22:44 +00:00
equivalent to zero elements, you can use the null-aware spread `...?` .
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
#### Collection if
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
Sometimes you might want to include one or more elements in a collection only
under certain conditions. If you're lucky, you can use a `?:` operator to
selectively swap out a single element, but if you want to exchange more than one
or omit elements, you are forced to write imperative code like this:
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
```dart
Widget build(BuildContext context) {
var children = [
IconButton(icon: Icon(Icons.menu)),
Expanded(child: title)
];
if (isAndroid) {
children.add(IconButton(icon: Icon(Icons.search)));
}
return Row(children: children);
}
```
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
We now allow `if` inside collection literals to conditionally omit or (with
`else` ) swap out an element:
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
```dart
Widget build(BuildContext context) {
return Row(
children: [
IconButton(icon: Icon(Icons.menu)),
Expanded(child: title),
if (isAndroid)
IconButton(icon: Icon(Icons.search)),
],
);
}
```
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
Unlike the existing `?:` operator, a collection `if` can be composed with
spreads to conditionally include or omit multiple items:
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
```dart
Widget build(BuildContext context) {
return Row(
children: [
IconButton(icon: Icon(Icons.menu)),
if (isAndroid) ...[
Expanded(child: title),
IconButton(icon: Icon(Icons.search)),
]
],
);
}
```
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
#### Collection for
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
In many cases, the higher-order methods on Iterable give you a declarative way
to modify a collection in the context of a single expression. But some
operations, especially involving both transforming and filtering, can be
cumbersome to express in a functional style.
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
To solve this problem, you can use `for` inside a collection literal. Each
iteration of the loop produces an element which is then inserted in the
resulting collection. Consider the following code:
2019-03-28 16:39:50 +00:00
2019-04-18 21:27:51 +00:00
```dart
var command = [
engineDartPath,
frontendServer,
...fileSystemRoots.map((root) => "--filesystem-root=$root"),
...entryPoints
.where((entryPoint) => fileExists("lib/$entryPoint.json"))
.map((entryPoint) => "lib/$entryPoint"),
mainPath
];
```
2019-03-28 16:39:50 +00:00
2019-04-18 21:27:51 +00:00
With a collection `for` , the code becomes simpler:
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
```dart
var command = [
engineDartPath,
frontendServer,
for (var root in fileSystemRoots) "--filesystem-root=$root",
for (var entryPoint in entryPoints)
if (fileExists("lib/$entryPoint.json")) "lib/$entryPoint",
mainPath
];
```
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
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].
2019-04-08 07:14:19 +00:00
2021-07-09 01:34:24 +00:00
[ui-as-code proposal]:
https://github.com/dart-lang/language/blob/master/accepted/future-releases/unified-collections/feature-specification.md
2019-04-08 07:14:19 +00:00
2021-07-09 01:34:24 +00:00
**Note: These features are not currently supported in _const_ collection
2019-04-18 21:27:51 +00:00
literals. In a future release, we intend to relax this restriction and allow
spread and collection `if` inside const collections.**
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
### Core library changes
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
#### `dart:isolate`
2019-04-08 07:14:19 +00:00
2021-07-09 01:34:24 +00:00
- Added `debugName` property to `Isolate` .
- Added `debugName` optional parameter to `Isolate.spawn` and
`Isolate.spawnUri` .
2019-04-08 07:14:19 +00:00
2019-04-18 21:27:51 +00:00
#### `dart:core`
2019-04-08 07:14:19 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2019-02-26 17:23:13 +00:00
2019-04-18 21:27:51 +00:00
### Dart VM
2019-03-14 17:24:04 +00:00
2021-07-09 01:34:24 +00:00
- The VM service now requires an authentication code by default. This behavior
can be disabled by providing the `--disable-service-auth-codes` flag.
2019-02-26 17:23:13 +00:00
2021-07-09 01:34:24 +00:00
- Support for deprecated flags '-c' and '--checked' has been removed.
2019-02-26 17:23:13 +00:00
2019-04-18 21:27:51 +00:00
### Dart for the Web
2019-02-26 17:23:13 +00:00
#### dart2js
2019-04-18 21:27:51 +00:00
A binary format was added to dump-info. The old JSON format is still available
and provided by default, but we are starting to deprecate it. The new binary
format is more compact and cheaper to generate. On some large apps we tested, it
was 4x faster to serialize and used 6x less memory.
2019-02-26 17:23:13 +00:00
2019-04-18 21:27:51 +00:00
To use the binary format today, use `--dump-info=binary` , instead of
`--dump-info` .
2019-02-26 17:23:13 +00:00
2019-04-18 21:27:51 +00:00
What to expect next?
2019-02-26 17:23:13 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2019-02-26 17:23:13 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2019-02-26 17:23:13 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2019-02-26 17:23:13 +00:00
2021-07-09 01:34:24 +00:00
- 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` .
2019-02-26 17:23:13 +00:00
[visualizer]: https://dart-lang.github.io/dump-info-visualizer/
2019-04-18 21:27:51 +00:00
### Tools
#### dartfmt
2021-07-09 01:34:24 +00:00
- 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.
2019-04-18 21:27:51 +00:00
#### Linter
The Linter was updated to `0.1.86` , which includes the following changes:
2021-07-09 01:34:24 +00:00
- 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`,
2019-04-18 21:27:51 +00:00
`.g.dart` , etc.).
2021-07-09 01:34:24 +00:00
- Fixed false positives in `unnecessary_parenthesis` .
2019-04-18 21:27:51 +00:00
2019-05-23 14:57:25 +00:00
#### Pub
2019-04-02 11:43:18 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2019-02-26 17:23:13 +00:00
2019-04-29 18:19:09 +00:00
#### 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:
2021-07-09 01:34:24 +00:00
- `dart2aot` : AOT (ahead-of-time) compiles a Dart program to native machine
code. The tool is supported on Windows, macOS, and Linux.
2019-04-29 18:19:09 +00:00
2021-07-09 01:34:24 +00:00
- `dartaotruntime` : A small runtime used for executing an AOT compiled program.
2019-04-29 18:19:09 +00:00
2019-02-26 17:23:13 +00:00
## 2.2.0 - 2019-02-26
2018-11-19 11:02:51 +00:00
### Language
2019-02-14 01:46:57 +00:00
Sets now have a literal syntax like lists and maps do:
2019-01-20 00:33:25 +00:00
2019-02-14 01:46:57 +00:00
```dart
var set = {1, 2, 3};
```
2019-01-17 23:05:21 +00:00
2019-02-14 01:46:57 +00:00
Using curly braces makes empty sets ambiguous with maps:
2019-01-28 13:31:05 +00:00
2019-02-14 01:46:57 +00:00
```dart
var collection = {}; // Empty set or map?
```
2019-01-28 13:31:05 +00:00
2021-07-09 01:34:24 +00:00
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:
2019-01-28 13:31:05 +00:00
2019-02-14 01:46:57 +00:00
```dart
// Variable type forces this to be a set:
Set< int > set = {};
2019-01-29 19:26:47 +00:00
2019-02-14 01:46:57 +00:00
// A single type argument means this must be a set:
var set2 = < int > {};
```
2019-01-29 19:26:47 +00:00
2019-02-14 01:46:57 +00:00
Set literals are released on all platforms. The `set-literals` experiment flag
has been disabled.
2018-11-19 11:02:51 +00:00
2019-02-14 01:46:57 +00:00
### Tools
2018-11-19 11:02:51 +00:00
2019-01-03 23:43:39 +00:00
#### Analyzer
2021-07-09 01:34:24 +00:00
- The `DEPRECATED_MEMBER_USE` hint was split into two hints:
2019-01-16 18:46:54 +00:00
2021-07-09 01:34:24 +00:00
- `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.
2019-01-16 18:46:54 +00:00
2019-02-14 01:46:57 +00:00
#### Linter
2019-01-25 21:51:24 +00:00
2019-02-14 01:46:57 +00:00
Upgraded the linter to `0.1.82` which adds the following improvements:
2019-01-25 21:51:24 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2019-01-25 21:51:24 +00:00
2019-02-14 01:46:57 +00:00
### Other libraries
2019-01-29 14:51:27 +00:00
2019-02-14 01:46:57 +00:00
#### `package:kernel`
2019-01-29 14:51:27 +00:00
2021-07-09 01:34:24 +00:00
- **Breaking change:** The `klass` getter on the `InstanceConstant` class in the
Kernel AST API has been renamed to `classNode` for consistency.
2019-01-29 14:51:27 +00:00
2021-07-09 01:34:24 +00:00
- **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.
2019-01-29 14:51:27 +00:00
2021-07-09 01:34:24 +00:00
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]).
2019-02-14 01:46:57 +00:00
[33966]: https://github.com/dart-lang/sdk/issues/33966
2019-01-29 14:51:27 +00:00
2019-02-14 01:46:57 +00:00
## 2.1.1 - 2019-02-18
2019-01-29 14:51:27 +00:00
2019-02-14 20:48:39 +00:00
This is a patch version release. Again, the team's focus was mostly on improving
2019-02-14 01:46:57 +00:00
performance and stability after the large changes in Dart 2.0.0. In particular,
dart2js now always uses the "fast startup" emitter and the old emitter has been
removed.
2019-01-29 14:51:27 +00:00
2019-02-14 01:46:57 +00:00
There are a couple of very minor **breaking changes:**
2021-07-09 01:34:24 +00:00
- In `dart:io` , adding to a closed `IOSink` now throws a `StateError` .
2019-02-14 01:46:57 +00:00
2021-07-09 01:34:24 +00:00
- 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][]).
2019-02-14 01:46:57 +00:00
### Language
2019-01-29 14:51:27 +00:00
2019-02-14 01:46:57 +00:00
This release has no language changes.
2019-01-29 14:51:27 +00:00
2019-02-14 01:46:57 +00:00
### Core library
2019-01-29 14:51:27 +00:00
#### `dart:core`
2021-07-09 01:34:24 +00:00
- Made `DateTime.parse()` also recognize `,` as a valid decimal separator when
parsing from a string (Issue [35576][]).
2019-01-29 14:51:27 +00:00
[35576]: https://github.com/dart-lang/sdk/issues/35576
2019-02-14 01:46:57 +00:00
#### `dart:html`
2019-01-29 14:51:27 +00:00
2021-07-09 01:34:24 +00:00
- 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<Object>` to match Set's `removeAll` not `Iterable<E>` (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.
2019-01-29 14:51:27 +00:00
2019-02-14 01:46:57 +00:00
[35655]: https://github.com/dart-lang/sdk/issues/35655
[30278]: https://github.com/dart-lang/sdk/issues/30278
[34318]: https://github.com/dart-lang/sdk/issues/34318
[35484]: https://github.com/dart-lang/sdk/issues/35484
[35510]: https://github.com/dart-lang/sdk/issues/35510
2019-01-14 15:51:46 +00:00
2019-02-14 01:46:57 +00:00
#### `dart:io`
2019-01-14 15:51:46 +00:00
2022-02-09 13:41:52 +00:00
- **Breaking change:** Adding to a closed `IOSink` now throws a `StateError` .
2021-07-09 01:34:24 +00:00
- Added ability to get and set low level socket options.
2019-01-14 15:51:46 +00:00
2019-02-14 01:46:57 +00:00
[29554]: https://github.com/dart-lang/sdk/issues/29554
2019-01-14 15:51:46 +00:00
2019-01-14 16:19:47 +00:00
### Dart VM
2019-01-20 00:33:25 +00:00
In previous releases it was possible to violate static types using
2019-02-14 01:46:57 +00:00
`dart:mirrors` . This code would run without any TypeErrors and print
"impossible" output:
2019-01-14 16:19:47 +00:00
```dart
import 'dart:mirrors';
class A {
void method(int v) {
if (v != null & & v is! int) {
print("This should be impossible: expected null or int got ${v}");
}
}
}
void main() {
final obj = A();
reflect(obj).invoke(#method, ['not-an-number']);
}
```
2019-02-14 01:46:57 +00:00
This bug is fixed now. Only code that already violates static typing will break.
See Issue [35611][] for more details.
2019-01-14 16:19:47 +00:00
2019-02-14 01:46:57 +00:00
[35611]: https://github.com/dart-lang/sdk/issues/35611
### Dart for the Web
2019-01-14 16:19:47 +00:00
2019-02-14 01:46:57 +00:00
#### dart2js
2021-07-09 01:34:24 +00:00
- 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.
2019-02-14 01:46:57 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2019-02-14 01:46:57 +00:00
2021-07-09 01:34:24 +00:00
- A new deferred split algorithm implementation was added.
2019-02-14 01:46:57 +00:00
2021-07-09 01:34:24 +00:00
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:
2019-02-14 01:46:57 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2019-02-14 01:46:57 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2019-02-14 01:46:57 +00:00
2021-07-09 01:34:24 +00:00
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:
2019-02-14 01:46:57 +00:00
2021-07-09 01:34:24 +00:00
```dart
() async {
await deferred_prefix.loadLibrary();
return new deferred_prefix.Foo();
}
```
2019-02-14 01:46:57 +00:00
2021-07-09 01:34:24 +00:00
The closure's return type is `Future<Foo>` . The old implementation defers
`Foo` , and incorrectly makes the return type `Future<dynamic>` . This may
break in places where the correct type is expected.
2019-02-14 01:46:57 +00:00
2021-07-09 01:34:24 +00:00
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:
2019-02-14 01:46:57 +00:00
2021-07-09 01:34:24 +00:00
```dart
() async {
await deferred_prefix.loadLibrary();
return new deferred_prefix.Foo() as dynamic;
}
```
2019-02-14 01:46:57 +00:00
2021-07-09 01:34:24 +00:00
Because the new implementation might require you to inspect and fix your
app, we exposed two temporary flags:
2019-02-14 01:46:57 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2019-02-14 01:46:57 +00:00
2021-07-09 01:34:24 +00:00
- The `--new-deferred-split` flag enables this new algorithm.
2019-02-14 01:46:57 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2019-02-14 01:46:57 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2019-02-14 01:46:57 +00:00
[35311]: https://github.com/dart-lang/sdk/issues/35311
### Tools
2019-01-14 15:51:46 +00:00
#### Analyzer
2021-07-09 01:34:24 +00:00
- 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:
- `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.
2019-01-20 00:33:25 +00:00
2019-01-04 20:16:24 +00:00
#### dartdoc
2019-02-14 01:46:57 +00:00
Default styles now work much better on mobile. Simple browsing and searching of
API docs now work in many cases.
Upgraded the linter to `0.1.78` which adds the following improvements:
2021-07-09 01:34:24 +00:00
- 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.
2018-11-20 20:48:00 +00:00
2018-11-19 11:27:50 +00:00
## 2.1.0 - 2018-11-15
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.
This caused a number of breaks especially in Service Workers (register, etc.). Here is a
complete list of the fixed APIs:
BackgroundFetchManager
Future<BackgroundFetchRegistration> fetch(String id, Object requests, [Map options])
CacheStorage
Future match(/*RequestInfo*/ request, [Map options])
CanMakePayment
Future<List<Client>> 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])
DirectoryEntry
Future<Entry> _getDirectory(String path, {Map options})
Future<Entry> _getFile(String path, {Map options})
ImageCapture
Future setOptions(Map photoSettings)
MediaCapabilities
Future<MediaCapabilitiesInfo> decodingInfo(Map configuration)
Future<MediaCapabilitiesInfo> encodingInfo(Map configuration)
MediaStreamTrack
Future applyConstraints([Map constraints])
Navigator
Future requestKeyboardLock([List<String> keyCodes])
Future requestMidiAccess([Map options])
Future share([Map data])
OffscreenCanvas
Future<Blob> convertToBlob([Map options])
PaymentInstruments
Future set(String instrumentKey, Map details)
Permissions
Future<PermissionStatus> query(Map permission)
Future<PermissionStatus> request(Map permissions)
Future<PermissionStatus> revoke(Map permission)
PushManager
Future permissionState([Map options])
Future<PushSubscription> subscribe([Map options])
RtcPeerConnection
REMOVED: Future createAnswer([options_OR_successCallback,
RtcPeerConnectionErrorCallback failureCallback,
Map mediaConstraints])
REMOVED: Future createOffer([options_OR_successCallback,
RtcPeerConnectionErrorCallback failureCallback,
Map rtcOfferOptions])
REMOVED: Future setLocalDescription(Map description, VoidCallback successCallback,
[RtcPeerConnectionErrorCallback failureCallback])
REMOVED: Future setLocalDescription(Map description, VoidCallback successCallback,
[RtcPeerConnectionErrorCallback failureCallback])
Future<RtcSessionDescription> createAnswer([Map options])
Future<RtcSessionDescription> createOffer([Map options])
Future setLocalDescription(Map description)
Future setRemoteDescription(Map description)
ServiceWorkerContainer
Future<ServiceWorkerRegistration> register(String url, [Map options])
ServiceWorkerRegistration
Future<List<Notification>> 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 (WorkerGlobalScope.instance will always work
and not throw):
* SharedWorkerGlobalScope.instance
* DedicatedWorkerGlobalScope.instance
* ServiceWorkerGlobalScope.instance
* WorkerGlobalScope.instance
R=vsm@google.com
Bug: #34202
Change-Id: I641ccbff7cc771465dd32c73db20eba5d6667939
Reviewed-on: https://dart-review.googlesource.com/c/74482
Commit-Queue: Terry Lucas <terry@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
2018-10-14 22:48:33 +00:00
2018-11-03 00:05:57 +00:00
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:
2018-10-30 15:54:58 +00:00
2021-07-09 01:34:24 +00:00
- We've introduced a dedicated syntax for declaring a mixin. Instead of the
`class` keyword, it uses `mixin` :
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.
This caused a number of breaks especially in Service Workers (register, etc.). Here is a
complete list of the fixed APIs:
BackgroundFetchManager
Future<BackgroundFetchRegistration> fetch(String id, Object requests, [Map options])
CacheStorage
Future match(/*RequestInfo*/ request, [Map options])
CanMakePayment
Future<List<Client>> 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])
DirectoryEntry
Future<Entry> _getDirectory(String path, {Map options})
Future<Entry> _getFile(String path, {Map options})
ImageCapture
Future setOptions(Map photoSettings)
MediaCapabilities
Future<MediaCapabilitiesInfo> decodingInfo(Map configuration)
Future<MediaCapabilitiesInfo> encodingInfo(Map configuration)
MediaStreamTrack
Future applyConstraints([Map constraints])
Navigator
Future requestKeyboardLock([List<String> keyCodes])
Future requestMidiAccess([Map options])
Future share([Map data])
OffscreenCanvas
Future<Blob> convertToBlob([Map options])
PaymentInstruments
Future set(String instrumentKey, Map details)
Permissions
Future<PermissionStatus> query(Map permission)
Future<PermissionStatus> request(Map permissions)
Future<PermissionStatus> revoke(Map permission)
PushManager
Future permissionState([Map options])
Future<PushSubscription> subscribe([Map options])
RtcPeerConnection
REMOVED: Future createAnswer([options_OR_successCallback,
RtcPeerConnectionErrorCallback failureCallback,
Map mediaConstraints])
REMOVED: Future createOffer([options_OR_successCallback,
RtcPeerConnectionErrorCallback failureCallback,
Map rtcOfferOptions])
REMOVED: Future setLocalDescription(Map description, VoidCallback successCallback,
[RtcPeerConnectionErrorCallback failureCallback])
REMOVED: Future setLocalDescription(Map description, VoidCallback successCallback,
[RtcPeerConnectionErrorCallback failureCallback])
Future<RtcSessionDescription> createAnswer([Map options])
Future<RtcSessionDescription> createOffer([Map options])
Future setLocalDescription(Map description)
Future setRemoteDescription(Map description)
ServiceWorkerContainer
Future<ServiceWorkerRegistration> register(String url, [Map options])
ServiceWorkerRegistration
Future<List<Notification>> 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 (WorkerGlobalScope.instance will always work
and not throw):
* SharedWorkerGlobalScope.instance
* DedicatedWorkerGlobalScope.instance
* ServiceWorkerGlobalScope.instance
* WorkerGlobalScope.instance
R=vsm@google.com
Bug: #34202
Change-Id: I641ccbff7cc771465dd32c73db20eba5d6667939
Reviewed-on: https://dart-review.googlesource.com/c/74482
Commit-Queue: Terry Lucas <terry@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
2018-10-14 22:48:33 +00:00
2021-07-09 01:34:24 +00:00
```dart
mixin SetMixin< E > implements Set< E > {
...
}
```
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
The new syntax also enables `super` calls inside mixins.
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
- 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` :
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
```dart
TextStyle(fontSize: 18.0)
```
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
Now you can remove the `.0` :
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
```dart
TextStyle(fontSize: 18)
```
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
In releases before 2.1, `fontSize : 18` causes a static error. This was a
common mistake and source of friction.
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
- **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.
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
- `dart:core` now exports `Future` and `Stream` . You no longer need to import
`dart:async` to use those very common types.
2018-10-16 17:48:22 +00:00
2018-11-03 00:05:57 +00:00
### Language
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
- Introduced a new syntax for mixin declarations.
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
```dart
mixin SetMixin< E > implements Set< E > {
...
}
```
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
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:
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
```dart
class Superclass {
superclassMethod() {
print("in superclass");
2018-11-03 00:05:57 +00:00
}
2021-07-09 01:34:24 +00:00
}
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
mixin SomeMixin on Superclass {
mixinMethod() {
// This is OK:
super.superclassMethod();
2018-11-03 00:05:57 +00:00
}
2021-07-09 01:34:24 +00:00
}
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
class GoodSub extends Superclass with SomeMixin {}
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
class BadSub extends Object with SomeMixin {}
// Error: Since the super() call in mixinMethod() can't find a
// superclassMethod() to call, this is prohibited.
```
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
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.
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2018-10-16 17:48:22 +00:00
2018-11-03 00:05:57 +00:00
**(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:
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
- **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:
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
```dart
class A {
set A(int x) {}
}
```
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
Dart 2.0.0 incorrectly allows this for setters (only). Dart 2.1.0 rejects it.
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
_To fix:_ This is unlikely to break anything, since it violates all style
guides anyway.
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
- **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:
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
```dart
class A {
const A.foo() : this(); // Redirecting to A()
A() {}
}
```
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
Dart 2.0.0 incorrectly allows this. Dart 2.1.0 rejects it.
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
_To fix:_ Make the target of the redirection a properly const constructor.
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
- **Abstract methods may not unsoundly override a concrete method.** (Issue
[32014][].) Concrete methods must be valid implementations of their
interfaces:
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
```dart
class A {
num get thing => 2.0;
}
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
abstract class B implements A {
int get thing;
}
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
class C extends A with B {}
// 'thing' from 'A' is not a valid override of 'thing' from 'B'.
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
main() {
print(new C().thing.isEven); // Expects an int but gets a double.
}
```
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
Dart 2.0.0 allows unsound overrides like the above in some cases. Dart 2.1.0
rejects them.
2018-10-16 17:48:22 +00:00
2021-07-09 01:34:24 +00:00
_To fix:_ Relax the type of the invalid override, or tighten the type of the
overridden method.
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.
This caused a number of breaks especially in Service Workers (register, etc.). Here is a
complete list of the fixed APIs:
BackgroundFetchManager
Future<BackgroundFetchRegistration> fetch(String id, Object requests, [Map options])
CacheStorage
Future match(/*RequestInfo*/ request, [Map options])
CanMakePayment
Future<List<Client>> 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])
DirectoryEntry
Future<Entry> _getDirectory(String path, {Map options})
Future<Entry> _getFile(String path, {Map options})
ImageCapture
Future setOptions(Map photoSettings)
MediaCapabilities
Future<MediaCapabilitiesInfo> decodingInfo(Map configuration)
Future<MediaCapabilitiesInfo> encodingInfo(Map configuration)
MediaStreamTrack
Future applyConstraints([Map constraints])
Navigator
Future requestKeyboardLock([List<String> keyCodes])
Future requestMidiAccess([Map options])
Future share([Map data])
OffscreenCanvas
Future<Blob> convertToBlob([Map options])
PaymentInstruments
Future set(String instrumentKey, Map details)
Permissions
Future<PermissionStatus> query(Map permission)
Future<PermissionStatus> request(Map permissions)
Future<PermissionStatus> revoke(Map permission)
PushManager
Future permissionState([Map options])
Future<PushSubscription> subscribe([Map options])
RtcPeerConnection
REMOVED: Future createAnswer([options_OR_successCallback,
RtcPeerConnectionErrorCallback failureCallback,
Map mediaConstraints])
REMOVED: Future createOffer([options_OR_successCallback,
RtcPeerConnectionErrorCallback failureCallback,
Map rtcOfferOptions])
REMOVED: Future setLocalDescription(Map description, VoidCallback successCallback,
[RtcPeerConnectionErrorCallback failureCallback])
REMOVED: Future setLocalDescription(Map description, VoidCallback successCallback,
[RtcPeerConnectionErrorCallback failureCallback])
Future<RtcSessionDescription> createAnswer([Map options])
Future<RtcSessionDescription> createOffer([Map options])
Future setLocalDescription(Map description)
Future setRemoteDescription(Map description)
ServiceWorkerContainer
Future<ServiceWorkerRegistration> register(String url, [Map options])
ServiceWorkerRegistration
Future<List<Notification>> 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 (WorkerGlobalScope.instance will always work
and not throw):
* SharedWorkerGlobalScope.instance
* DedicatedWorkerGlobalScope.instance
* ServiceWorkerGlobalScope.instance
* WorkerGlobalScope.instance
R=vsm@google.com
Bug: #34202
Change-Id: I641ccbff7cc771465dd32c73db20eba5d6667939
Reviewed-on: https://dart-review.googlesource.com/c/74482
Commit-Queue: Terry Lucas <terry@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
2018-10-14 22:48:33 +00:00
2021-07-09 01:34:24 +00:00
- **Classes can't implement FutureOr.** (Issue [33744][].) Dart doesn't allow
classes to implement the FutureOr type:
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.
This caused a number of breaks especially in Service Workers (register, etc.). Here is a
complete list of the fixed APIs:
BackgroundFetchManager
Future<BackgroundFetchRegistration> fetch(String id, Object requests, [Map options])
CacheStorage
Future match(/*RequestInfo*/ request, [Map options])
CanMakePayment
Future<List<Client>> 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])
DirectoryEntry
Future<Entry> _getDirectory(String path, {Map options})
Future<Entry> _getFile(String path, {Map options})
ImageCapture
Future setOptions(Map photoSettings)
MediaCapabilities
Future<MediaCapabilitiesInfo> decodingInfo(Map configuration)
Future<MediaCapabilitiesInfo> encodingInfo(Map configuration)
MediaStreamTrack
Future applyConstraints([Map constraints])
Navigator
Future requestKeyboardLock([List<String> keyCodes])
Future requestMidiAccess([Map options])
Future share([Map data])
OffscreenCanvas
Future<Blob> convertToBlob([Map options])
PaymentInstruments
Future set(String instrumentKey, Map details)
Permissions
Future<PermissionStatus> query(Map permission)
Future<PermissionStatus> request(Map permissions)
Future<PermissionStatus> revoke(Map permission)
PushManager
Future permissionState([Map options])
Future<PushSubscription> subscribe([Map options])
RtcPeerConnection
REMOVED: Future createAnswer([options_OR_successCallback,
RtcPeerConnectionErrorCallback failureCallback,
Map mediaConstraints])
REMOVED: Future createOffer([options_OR_successCallback,
RtcPeerConnectionErrorCallback failureCallback,
Map rtcOfferOptions])
REMOVED: Future setLocalDescription(Map description, VoidCallback successCallback,
[RtcPeerConnectionErrorCallback failureCallback])
REMOVED: Future setLocalDescription(Map description, VoidCallback successCallback,
[RtcPeerConnectionErrorCallback failureCallback])
Future<RtcSessionDescription> createAnswer([Map options])
Future<RtcSessionDescription> createOffer([Map options])
Future setLocalDescription(Map description)
Future setRemoteDescription(Map description)
ServiceWorkerContainer
Future<ServiceWorkerRegistration> register(String url, [Map options])
ServiceWorkerRegistration
Future<List<Notification>> 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 (WorkerGlobalScope.instance will always work
and not throw):
* SharedWorkerGlobalScope.instance
* DedicatedWorkerGlobalScope.instance
* ServiceWorkerGlobalScope.instance
* WorkerGlobalScope.instance
R=vsm@google.com
Bug: #34202
Change-Id: I641ccbff7cc771465dd32c73db20eba5d6667939
Reviewed-on: https://dart-review.googlesource.com/c/74482
Commit-Queue: Terry Lucas <terry@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
2018-10-14 22:48:33 +00:00
2021-07-09 01:34:24 +00:00
```dart
class A implements FutureOr< Object > {}
```
2018-08-09 07:32:09 +00:00
2021-07-09 01:34:24 +00:00
Dart 2.0.0 allows classes to implement FutureOr. Dart 2.1.0 does not.
2018-08-09 07:32:09 +00:00
2021-07-09 01:34:24 +00:00
_To fix:_ Don't do this.
2018-10-11 20:15:23 +00:00
2021-07-09 01:34:24 +00:00
- **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:
2018-10-11 20:15:23 +00:00
2021-07-09 01:34:24 +00:00
```dart
class A< X extends int > {}
2018-10-10 18:36:42 +00:00
2021-07-09 01:34:24 +00:00
typedef F< Y extends int > = A< Y > Function();
2018-10-23 20:53:34 +00:00
2021-07-09 01:34:24 +00:00
F< num > f = null;
```
2018-10-10 18:36:42 +00:00
2021-07-09 01:34:24 +00:00
Dart 2.0.0 allows bounds violations like `F<num>` above. Dart 2.1.0 rejects
them.
2018-10-10 18:36:42 +00:00
2021-07-09 01:34:24 +00:00
_To fix:_ Either remove the bound on the typedef parameter, or pass a valid
argument to the typedef.
2018-10-17 17:41:26 +00:00
2021-07-09 01:34:24 +00:00
- **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` :
2018-10-17 17:41:26 +00:00
2021-07-09 01:34:24 +00:00
```dart
class A< T > {
A.foo() {}
}
2018-10-17 17:41:26 +00:00
2021-07-09 01:34:24 +00:00
main() {
A.foo< String > (); // Incorrect syntax, was accepted in 2.0.0.
A< String > .foo(); // Correct syntax.
}
```
2018-10-17 17:41:26 +00:00
2021-07-09 01:34:24 +00:00
Dart 2.0.0 accepts the incorrect syntax when the `new` keyword is left out.
Dart 2.1.0 correctly rejects this code.
2018-10-17 17:41:26 +00:00
2021-07-09 01:34:24 +00:00
_To fix:_ Move the type argument to the correct position after the class name.
2018-10-10 18:36:42 +00:00
2021-07-09 01:34:24 +00:00
- **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.
2018-10-12 00:18:34 +00:00
2021-07-09 01:34:24 +00:00
```dart
import 'dart:core';
import 'dart:core' as core;
2018-10-12 00:18:34 +00:00
2021-07-09 01:34:24 +00:00
class A {
core.List get core => null; // "core" refers to field, not prefix.
}
```
2018-10-10 18:36:42 +00:00
2021-07-09 01:34:24 +00:00
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.
2018-10-10 18:36:42 +00:00
2021-07-09 01:34:24 +00:00
_To fix:_ Change the prefix name to something which does not clash with the
instance member.
2018-10-10 18:36:42 +00:00
2021-07-09 01:34:24 +00:00
- **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:
2018-10-03 14:56:43 +00:00
2021-07-09 01:34:24 +00:00
```dart
class Foo< T > {}
2018-10-03 14:56:43 +00:00
2021-07-09 01:34:24 +00:00
class Bar< T extends Foo < T > > {}
2018-10-03 14:56:43 +00:00
2021-07-09 01:34:24 +00:00
class Baz extends Bar {} // Should error because Bar completes to Bar< Foo >
```
2018-10-03 14:56:43 +00:00
2021-07-09 01:34:24 +00:00
Dart 2.0.0 accepts the broken code above. Dart 2.1.0 rejects it.
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
_To fix:_ Provide explicit type arguments to the superclass that satisfy the
bound for the superclass.
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
- **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:
2018-10-03 14:56:43 +00:00
2021-07-09 01:34:24 +00:00
```dart
class A {
num get thing => 2.0;
}
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
class M1 {
int get thing => 2;
}
2018-10-03 14:56:43 +00:00
2021-07-09 01:34:24 +00:00
class B = A with M1;
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
class M2 {
num get thing => 2.0;
}
2018-10-03 14:56:43 +00:00
2021-07-09 01:34:24 +00:00
class C extends B with M2 {} // 'thing' from 'M2' not a valid override.
2018-10-03 14:56:43 +00:00
2021-07-09 01:34:24 +00:00
main() {
M1 a = new C();
print(a.thing.isEven); // Expects an int but gets a double.
}
```
2018-10-03 14:56:43 +00:00
2021-07-09 01:34:24 +00:00
Dart 2.0.0 accepts the above example. Dart 2.1.0 rejects it.
2018-09-27 08:31:44 +00:00
2021-07-09 01:34:24 +00:00
_To fix:_ Ensure that overriding methods are correct overrides of their
superclasses, either by relaxing the superclass type, or tightening the
subclass/mixin type.
2018-09-27 08:31:44 +00:00
2018-11-03 00:05:57 +00:00
[32014]: https://github.com/dart-lang/sdk/issues/32014
[33308]: https://github.com/dart-lang/sdk/issues/33308
[33744]: https://github.com/dart-lang/sdk/issues/33744
[34161]: https://github.com/dart-lang/sdk/issues/34161
[34225]: https://github.com/dart-lang/sdk/issues/34225
[34235]: https://github.com/dart-lang/sdk/issues/34235
[34403]: https://github.com/dart-lang/sdk/issues/34403
[34498]: https://github.com/dart-lang/sdk/issues/34498
[34532]: https://github.com/dart-lang/sdk/issues/34532
2018-09-27 08:31:44 +00:00
2018-11-03 00:05:57 +00:00
### Core libraries
2018-08-28 05:11:12 +00:00
2018-09-11 11:07:01 +00:00
#### `dart:async`
2021-07-09 01:34:24 +00:00
- 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][]).
2018-09-11 11:07:01 +00:00
2018-11-03 00:05:57 +00:00
[33431]: http://dartbug.com/33431
2018-09-27 08:31:44 +00:00
#### `dart:core`
2021-07-09 01:34:24 +00:00
- 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.
2018-09-27 08:31:44 +00:00
2018-11-03 00:05:57 +00:00
#### `dart:html`
2018-09-27 08:31:44 +00:00
2018-11-03 00:05:57 +00:00
Fixed Service Workers and any Promise/Future API with a Dictionary parameter.
2018-09-27 08:31:44 +00:00
2018-11-03 00:05:57 +00:00
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
2021-07-09 01:34:24 +00:00
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.
2018-09-18 21:11:10 +00:00
2018-11-03 00:05:57 +00:00
This caused a number of breaks especially in Service Workers (register, etc.).
Here is a complete list of the fixed APIs:
2018-08-28 08:05:52 +00:00
2021-07-09 01:34:24 +00:00
- BackgroundFetchManager
- `Future<BackgroundFetchRegistration> fetch(String id, Object requests, [Map options])`
- CacheStorage
- `Future match(/*RequestInfo*/ request, [Map options])`
- CanMakePayment
- `Future<List<Client>> 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<MediaCapabilitiesInfo> decodingInfo(Map configuration)`
- `Future<MediaCapabilitiesInfo> encodingInfo(Map configuration)`
- MediaStreamTrack
- `Future applyConstraints([Map constraints])`
- Navigator
- `Future requestKeyboardLock([List<String> keyCodes])`
- `Future requestMidiAccess([Map options])`
- `Future share([Map data])`
- OffscreenCanvas
- `Future<Blob> convertToBlob([Map options])`
- PaymentInstruments
- `Future set(String instrumentKey, Map details)`
- Permissions
- `Future<PermissionStatus> query(Map permission)`
- `Future<PermissionStatus> request(Map permissions)`
- `Future<PermissionStatus> revoke(Map permission)`
- PushManager
- `Future permissionState([Map options])`
- `Future<PushSubscription> subscribe([Map options])`
- RtcPeerConnection
- Changed:
```dart
Future createAnswer([options_OR_successCallback,
RtcPeerConnectionErrorCallback failureCallback,
Map mediaConstraints])
```
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
to:
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
```dart
Future< RtcSessionDescription > createAnswer([Map options])
```
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
- Changed:
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
```dart
Future createOffer([options_OR_successCallback,
RtcPeerConnectionErrorCallback failureCallback,
Map rtcOfferOptions])
```
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
to:
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
```dart
Future< RtcSessionDescription > createOffer([Map options])
```
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
- Changed:
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
```dart
Future setLocalDescription(Map description,
VoidCallback successCallback,
[RtcPeerConnectionErrorCallback failureCallback])
```
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
to:
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
```dart
Future setLocalDescription(Map description)
```
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
- Changed:
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
```dart
Future setLocalDescription(Map description,
VoidCallback successCallback,
[RtcPeerConnectionErrorCallback failureCallback])
```
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
to:
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
```dart
Future setRemoteDescription(Map description)
```
2018-11-03 00:05:57 +00:00
2021-07-09 01:34:24 +00:00
- ServiceWorkerContainer
- `Future<ServiceWorkerRegistration> register(String url, [Map options])`
- ServiceWorkerRegistration
- `Future<List<Notification>> 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])`
2018-08-28 08:05:52 +00:00
2018-11-03 00:05:57 +00:00
In addition, exposed Service Worker "self" as a static getter named "instance".
2021-07-09 01:34:24 +00:00
The instance is exposed on four different Service Worker classes and can throw a
InstanceTypeError if the instance isn't of the class expected
2018-11-03 00:05:57 +00:00
(WorkerGlobalScope.instance will always work and not throw):
2018-08-28 08:05:52 +00:00
2021-07-09 01:34:24 +00:00
- `SharedWorkerGlobalScope.instance`
- `DedicatedWorkerGlobalScope.instance`
- `ServiceWorkerGlobalScope.instance`
- `WorkerGlobalScope.instance`
2018-08-28 08:05:52 +00:00
2018-11-03 00:05:57 +00:00
#### `dart:io`
2018-08-22 17:57:44 +00:00
2021-07-09 01:34:24 +00:00
- Added new HTTP status codes.
2018-08-22 17:57:44 +00:00
2018-11-03 00:05:57 +00:00
### Dart for the Web
2018-08-22 17:35:41 +00:00
2018-11-03 00:05:57 +00:00
#### dart2js
2018-08-22 17:35:41 +00:00
2021-07-09 01:34:24 +00:00
- **(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.
2018-08-09 07:32:09 +00:00
2021-07-09 01:34:24 +00:00
- Added `-O` flag to tune optimization levels. For more details run
`dart2js -h -v` .
2018-08-22 17:57:44 +00:00
2021-07-09 01:34:24 +00:00
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.
2018-08-17 07:55:12 +00:00
2021-07-09 01:34:24 +00:00
At this time we recommend to test and debug with `-O1` and to deploy with
`-O3` .
2018-08-16 09:29:11 +00:00
### Tool Changes
2018-11-03 00:05:57 +00:00
#### dartfmt
2018-08-16 09:29:11 +00:00
2021-07-09 01:34:24 +00:00
- Addressed several dartfmt issues when used with the new CFE parser.
2018-08-08 22:05:00 +00:00
2018-11-03 00:05:57 +00:00
#### Linter
2018-08-08 22:05:00 +00:00
2018-11-03 00:05:57 +00:00
Bumped the linter to `0.1.70` which includes the following new lints:
2018-08-08 22:05:00 +00:00
2021-07-09 01:34:24 +00:00
- `avoid_returning_null_for_void`
- `sort_pub_dependencies`
- `prefer_mixin`
- `avoid_implementing_value_types`
- `flutter_style_todos`
- `avoid_void_async`
- `prefer_void_to_null`
2018-08-08 22:05:00 +00:00
2018-11-03 00:05:57 +00:00
and improvements:
2018-08-09 18:14:15 +00:00
2021-07-09 01:34:24 +00:00
- 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` .
2018-08-09 18:14:15 +00:00
2018-11-03 00:05:57 +00:00
#### Pub
2018-08-09 18:14:15 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2018-08-09 18:14:15 +00:00
2018-08-10 13:42:43 +00:00
## 2.0.0 - 2018-08-07
2018-06-12 19:53:49 +00:00
2018-08-02 01:07:22 +00:00
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:
2018-06-11 12:39:35 +00:00
2021-07-09 01:34:24 +00:00
- **(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.
2018-06-11 12:39:35 +00:00
2021-07-09 01:34:24 +00:00
- **(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][]).
2018-06-11 12:39:35 +00:00
2021-07-09 01:34:24 +00:00
- **(Breaking)** Constants in the core libraries have been renamed from
`SCREAMING_CAPS` to `lowerCamelCase` .
2018-06-06 14:32:13 +00:00
2021-07-09 01:34:24 +00:00
- **(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.
2018-05-29 20:01:09 +00:00
2021-07-09 01:34:24 +00:00
- **(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.
2018-06-06 19:06:04 +00:00
2022-02-08 19:29:56 +00:00
- **(Breaking)** Pub's transformer-based build system has been replaced by a
[new build system][build system].
2018-06-07 16:18:33 +00:00
2021-07-09 01:34:24 +00:00
- The `new` keyword is optional and can be omitted. Likewise, `const` can be
omitted inside a const context ([issue 30921][]).
2018-08-02 22:01:19 +00:00
2021-07-09 01:34:24 +00:00
- Dartium is no longer maintained or supported.
2018-08-02 22:01:19 +00:00
2018-08-02 01:07:22 +00:00
[issue 30345]: https://github.com/dart-lang/sdk/issues/30345
[issue 30921]: https://github.com/dart-lang/sdk/issues/30921
2022-02-08 19:29:56 +00:00
[strong mode]: https://dart.dev/guides/language/type-system
[build system]: https://github.com/dart-lang/build
2018-05-29 20:01:09 +00:00
### Language
2021-07-09 01:34:24 +00:00
- "[Strong mode][]" is now the official type system of the language.
2018-05-24 20:23:42 +00:00
2021-07-09 01:34:24 +00:00
- The `new` keyword is optional and can be omitted. Likewise, `const` can be
omitted inside a const context.
2018-05-24 20:23:42 +00:00
2021-07-09 01:34:24 +00:00
- 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:
2018-05-24 20:23:42 +00:00
2021-07-09 01:34:24 +00:00
```dart
part of name.of.library;
```
2018-05-23 15:37:08 +00:00
2021-07-09 01:34:24 +00:00
Or:
2018-05-23 15:37:08 +00:00
2021-07-09 01:34:24 +00:00
```dart
part of "uriReferenceOfLibrary.dart";
```
2018-05-23 15:37:08 +00:00
2021-07-09 01:34:24 +00:00
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.
2018-05-23 15:37:08 +00:00
2021-07-09 01:34:24 +00:00
- 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][]).
2018-05-23 15:37:08 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2018-05-22 14:35:50 +00:00
2021-07-09 01:34:24 +00:00
- 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` .
2018-05-22 14:35:50 +00:00
2021-07-09 01:34:24 +00:00
```dart
test() {
Future< int > f;
var x = f.then< Future < List < int > >>((x) => []);
Future< List < int > > y = x;
}
```
2018-04-27 20:07:55 +00:00
2021-07-09 01:34:24 +00:00
- 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".
2018-04-27 20:07:55 +00:00
2021-07-09 01:34:24 +00:00
```dart
abstract class B {
void m([int x = 3]);
}
2018-04-18 18:50:35 +00:00
2021-07-09 01:34:24 +00:00
class A implements B {
noSuchMethod(Invocation i) {
if (i.positionalArguments.length == 0) {
print("No arguments passed");
} else {
print("First argument is ${i.positionalArguments[0]}");
2018-08-02 01:07:22 +00:00
}
}
2021-07-09 01:34:24 +00:00
}
2018-04-12 13:16:49 +00:00
2021-07-09 01:34:24 +00:00
void main() {
A().m();
}
```
2018-04-06 16:24:52 +00:00
2021-07-09 01:34:24 +00:00
- Bounds on generic functions are invariant. The following program now issues an
invalid override error ([issue 29014][sdk#29014]):
2018-04-16 21:14:59 +00:00
2021-07-09 01:34:24 +00:00
```dart
class A {
void f< T extends int > () {}
}
2018-04-16 21:14:59 +00:00
2021-07-09 01:34:24 +00:00
class B extends A {
@override
void f< T extends num > () {}
}
```
2018-04-16 21:14:59 +00:00
2021-07-09 01:34:24 +00:00
- Numerous corner case bugs around return statements in synchronous and
asynchronous functions fixed. Specifically:
2018-04-18 18:50:35 +00:00
2021-07-09 01:34:24 +00:00
- 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.
2018-04-18 18:50:35 +00:00
2021-07-09 01:34:24 +00:00
- An empty `return;` in an async function with return type `Future<Object>` does
not report an error.
2018-04-06 16:24:52 +00:00
2021-07-09 01:34:24 +00:00
- `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` .
2018-04-06 16:24:52 +00:00
2021-07-09 01:34:24 +00:00
- Mixed return statements of the form `return;` and `return exp;` are now
allowed when `exp` has type `void` .
2018-04-18 18:50:35 +00:00
2021-07-09 01:34:24 +00:00
- 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][]).
2018-04-06 10:35:52 +00:00
2021-07-09 01:34:24 +00:00
- New member conflict rules have been implemented. Most cases of conflicting
members with the same name are now static errors ([issue 33235][]).
2018-04-06 10:35:52 +00:00
2018-08-02 01:07:22 +00:00
[sdk#29014]: https://github.com/dart-lang/sdk/issues/29014
[issue 30638]: https://github.com/dart-lang/sdk/issues/30638
[issue 31278]: https://github.com/dart-lang/sdk/issues/31278
[issue 31887]: https://github.com/dart-lang/sdk/issues/31887
[issue 32233]: https://github.com/dart-lang/sdk/issues/32233
[issue 32881]: https://github.com/dart-lang/sdk/issues/32881
[issue 33218]: https://github.com/dart-lang/sdk/issues/33218
[issue 33235]: https://github.com/dart-lang/sdk/issues/33235
[issue 33282]: https://github.com/dart-lang/sdk/issues/33282
[issue 33341]: https://github.com/dart-lang/sdk/issues/33341
### Core libraries
2021-07-09 01:34:24 +00:00
- Replaced `UPPER_CASE` constant names with `lowerCamelCase` . For example,
`HTML_ESCAPE` is now `htmlEscape` .
2018-08-02 01:07:22 +00:00
2021-07-09 01:34:24 +00:00
- The Web libraries were re-generated using Chrome 63 WebIDLs ([details][idl]).
2018-08-02 01:07:22 +00:00
[idl]: https://github.com/dart-lang/sdk/wiki/Chrome-63-Dart-Web-Libraries
#### `dart:async`
2021-07-09 01:34:24 +00:00
- `Stream` :
- Added `cast` and `castFrom` .
- Changed `firstWhere` , `lastWhere` , and `singleWhere` to return `Future<T>`
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 ).
2018-04-06 10:35:52 +00:00
2018-08-02 01:07:22 +00:00
#### `dart:cli`
2018-04-18 18:50:35 +00:00
2021-07-09 01:34:24 +00:00
- _New_ "provisional" library for CLI-specific features.
- `waitFor` : function that suspends a stack to wait for a `Future` to complete.
2018-04-18 18:50:35 +00:00
2018-08-02 01:07:22 +00:00
#### `dart:collection`
2018-03-08 23:14:22 +00:00
2021-07-09 01:34:24 +00:00
- `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.
2018-08-02 01:07:22 +00:00
#### `dart:convert`
2021-07-09 01:34:24 +00:00
- `Base64Codec.decode` return type is now `Uint8List` .
- `JsonUnsupportedObjectError` : added `partialResult` property
- `LineSplitter` now implements `StreamTransformer<String, String>` 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.
2018-08-02 01:07:22 +00:00
#### `dart:core`
2021-07-09 01:34:24 +00:00
- `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 ))
2018-08-02 01:07:22 +00:00
#### `dart:developer`
2021-07-09 01:34:24 +00:00
- `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` .
2017-09-20 15:46:06 +00:00
2018-02-22 04:12:44 +00:00
<!--
Still need entries for all changes to dart:html since 1.x
-->
2018-08-02 01:07:22 +00:00
#### `dart:html`
2021-07-09 01:34:24 +00:00
- Removed deprecated `query` and `queryAll` . Use `querySelector` and
`querySelectorAll` .
2018-08-02 01:07:22 +00:00
#### `dart:io`
2018-02-22 04:12:44 +00:00
2021-07-09 01:34:24 +00:00
- `HttpStatus` added `UPGRADE_REQUIRED` .
- `IOOverrides` and `HttpOverrides` added to aid in writing tests that wish to
mock varios `dart:io` objects.
- `Platform.operatingSystemVersion` added that gives a platform-specific String
describing the version of the operating system.
- `ProcessStartMode.INHERIT_STDIO` added, which allows a child process to
inherit the parent's stdio handles.
- `RawZLibFilter` added for low-level access to compression and decompression
routines.
- Unified backends for `SecureSocket` , `SecurityContext` , and `X509Certificate`
to be consistent across all platforms. All `SecureSocket` , `SecurityContext` ,
and `X509Certificate` properties and methods are now supported on iOS and OSX.
- `SecurityContext.alpnSupported` deprecated as ALPN is now supported on all
platforms.
- `SecurityContext` : added `withTrustedRoots` named optional parameter
constructor, which defaults to false.
- Added a `timeout` parameter to `Socket.connect` , `RawSocket.connect` ,
`SecureSocket.connect` and `RawSecureSocket.connect` . If a connection attempt
takes longer than the duration specified in `timeout` , a `SocketException`
will be thrown. Note: if the duration specified in `timeout` is greater than
the OS level timeout, a timeout may occur sooner than specified in `timeout` .
- `Stdin.hasTerminal` added, which is true if stdin is attached to a terminal.
- `WebSocket` added static `userAgent` property.
- `RandomAccessFile.close` returns `Future<void>`
- Added `IOOverrides.socketConnect` .
- Added Dart-styled constants to `ZLibOptions` , `FileMode` , `FileLock` ,
`FileSystemEntityType` , `FileSystemEvent` , `ProcessStartMode` ,
`ProcessSignal` , `InternetAddressType` , `InternetAddress` , `SocketDirection` ,
`SocketOption` , `RawSocketEvent` , and `StdioType` , and deprecated the old
`SCREAMING_CAPS` constants.
- Added the Dart-styled top-level constants `zlib` , `gzip` , and
`systemEncoding` , and deprecated the old `SCREAMING_CAPS` top-level constants.
- Removed the top-level `FileMode` constants `READ` , `WRITE` , `APPEND` ,
`WRITE_ONLY` , and `WRITE_ONLY_APPEND` . Please use e.g. `FileMode.read`
instead.
- Added `X509Certificate.der` , `X509Certificate.pem` , and
`X509Certificate.sha1` .
- Added `FileSystemEntity.fromRawPath` constructor to allow for the creation of
`FileSystemEntity` using `Uint8List` buffers.
- Dart-styled constants have been added for `HttpStatus` , `HttpHeaders` ,
`ContentType` , `HttpClient` , `WebSocketStatus` , `CompressionOptions` , and
`WebSocket` . The `SCREAMING_CAPS` constants are marked deprecated. Note that
`HttpStatus.CONTINUE` is now `HttpStatus.continue_` , and that e.g.
`HttpHeaders.FIELD_NAME` is now `HttpHeaders.fieldNameHeader` .
- Deprecated `Platform.packageRoot` , which is only used for `packages/`
directory resolution which is no longer supported. It will now always return
null, which is a value that was always possible for it to return previously.
- Adds `HttpClient.connectionTimeout` .
- Adds `{Socket,RawSocket,SecureSocket}.startConnect` . These return a
`ConnectionTask` , which can be used to cancel an in-flight connection attempt.
2018-08-02 01:07:22 +00:00
#### `dart:isolate`
2021-07-09 01:34:24 +00:00
- Make `Isolate.spawn` take a type parameter representing the argument type of
the provided function. This allows functions with arguments types other than
`Object` in strong mode.
- Rename `IMMEDIATE` and `BEFORE_NEXT_EVENT` on `Isolate` to `immediate` and
`beforeNextEvent` .
- Deprecated `Isolate.packageRoot` , which is only used for `packages/` directory
resolution which is no longer supported. It will now always return null, which
is a value that was always possible for it to return previously.
- Deprecated `packageRoot` parameter in `Isolate.spawnUri` , which is was
previously used only for `packages/` directory resolution. That style of
resolution is no longer supported in Dart 2.
2018-02-22 04:12:44 +00:00
<!--
Still need entries for all changes to dart:js since 1.x
-->
2017-11-24 12:44:17 +00:00
2018-08-02 01:07:22 +00:00
#### `dart.math`
2018-02-22 04:12:44 +00:00
2021-07-09 01:34:24 +00:00
- Renamed `E` , `LN10` , `LN` , `LOG2E` , `LOG10E` , `PI` , `SQRT1_2` and `SQRT2` to
`e` , `ln10` , `ln` , `log2e` , `log10e` , `pi` , `sqrt1_2` and `sqrt2` .
2017-11-20 19:33:46 +00:00
2018-08-02 01:07:22 +00:00
#### `dart.mirrors`
2021-07-09 01:34:24 +00:00
- Added `IsolateMirror.loadUri` , which allows dynamically loading additional
code.
- Marked `MirrorsUsed` as deprecated. The `MirrorsUsed` annotation was only used
to inform the dart2js compiler about how mirrors were used, but dart2js no
longer supports the mirrors library altogether.
2018-05-29 22:01:01 +00:00
2018-02-22 04:12:44 +00:00
<!--
Still need entries for all changes to dart:svg since 1.x
-->
2018-08-02 01:07:22 +00:00
#### `dart:typed_data`
2018-02-22 04:12:44 +00:00
2021-07-09 01:34:24 +00:00
- Added `Unmodifiable` view classes over all `List` types.
- Renamed `BYTES_PER_ELEMENT` to `bytesPerElement` on all typed data lists.
- Renamed constants `XXXX` through `WWWW` on `Float32x4` and `Int32x4` to
lower-case `xxxx` through `wwww` .
- Renamed `Endinanness` to `Endian` and its constants from `BIG_ENDIAN` ,
`LITTLE_ENDIAN` and `HOST_ENDIAN` to `little` , `big` and `host` .
2017-07-31 14:46:50 +00:00
2018-02-22 04:12:44 +00:00
<!--
Still need entries for all changes to dart:web_audio,web_gl,web_sql since 1.x
-->
2017-06-01 11:54:18 +00:00
### Dart VM
2018-01-19 21:55:40 +00:00
2021-07-09 01:34:24 +00:00
- Support for MIPS has been removed.
2017-06-01 11:54:18 +00:00
2021-07-09 01:34:24 +00:00
- Dart `int` is now restricted to 64 bits. On overflow, arithmetic operations
wrap around, and integer literals larger than 64 bits are not allowed. See
2021-09-15 06:22:23 +00:00
https://github.com/dart-lang/sdk/blob/main/docs/language/informal/int64.md
2021-07-09 01:34:24 +00:00
for details.
2018-01-19 21:55:40 +00:00
2021-07-09 01:34:24 +00:00
- The Dart VM no longer attempts to perform `packages/` directory resolution
(for loading scripts, and in `Isolate.resolveUri` ). Users relying on
`packages/` directories should switch to `.packages` files.
2017-06-01 11:54:18 +00:00
2018-08-02 01:07:22 +00:00
### Dart for the Web
2017-12-15 18:12:03 +00:00
2021-07-09 01:34:24 +00:00
- Expose JavaScript Promise APIs using Dart futures. For example,
`BackgroundFetchManager.get` is defined as:
2018-03-16 15:43:37 +00:00
2021-07-09 01:34:24 +00:00
```dart
Future< BackgroundFetchRegistration > get(String id)
```
2018-03-16 15:43:37 +00:00
2021-07-09 01:34:24 +00:00
It can be used like:
2018-01-03 19:05:40 +00:00
2021-07-09 01:34:24 +00:00
```dart
BackgroundFetchRegistration result = await fetchMgr.get('abc');
```
2017-12-15 18:12:03 +00:00
2021-07-09 01:34:24 +00:00
The underlying JS Promise-to-Future mechanism will be exposed as a public API
in the future.
2018-08-02 01:07:22 +00:00
#### Dart Dev Compiler (DDC)
2021-07-09 01:34:24 +00:00
- dartdevc will no longer throw an error from `is` checks that return a
different result in weak mode (SDK [issue 28988][sdk#28988]). For example:
2018-03-16 15:43:37 +00:00
2021-07-09 01:34:24 +00:00
```dart
main() {
List l = [];
// Prints "false", does not throw.
print(l is List< String > );
}
```
2018-01-03 19:05:40 +00:00
2021-07-09 01:34:24 +00:00
- Failed `as` casts on `Iterable<T>` , `Map<T>` , `Future<T>` , and `Stream<T>` are
no longer ignored. These failures were ignored to make it easier to migrate
Dart 1 code to strong mode, but ignoring them is a hole in the type system.
This closes part of that hole. (We still need to stop ignoring "as" cast
failures on function types, and implicit cast failures on the above types and
function types.)
2018-01-03 19:05:40 +00:00
2018-08-02 01:07:22 +00:00
[sdk#28988]: https://github.com/dart-lang/sdk/issues/28988
2017-06-08 22:14:28 +00:00
2018-08-02 01:07:22 +00:00
#### dart2js
2017-06-29 20:50:09 +00:00
2021-07-09 01:34:24 +00:00
- dart2js now compiles programs with Dart 2.0 semantics. Apps are expected to be
bigger than before, because Dart 2.0 has many more implicit checks (similar to
the `--checked` flag in Dart 1.0).
2017-12-21 04:22:52 +00:00
2021-07-09 01:34:24 +00:00
We exposed a `--omit-implicit-checks` flag which removes most of the extra
implicit checks. Only use this if you have enough test coverage to know that
the app will work well without the checks. If a check would have failed and it
is omitted, your app may crash or behave in unexpected ways. This flag is
similar to `--trust-type-annotations` in Dart 1.0.
2017-12-21 04:22:52 +00:00
2021-07-09 01:34:24 +00:00
- dart2js replaced its front-end with the common front-end (CFE). Thanks to the
CFE, dart2js errors are more consistent with all other Dart tools.
2017-12-21 04:22:52 +00:00
2021-07-09 01:34:24 +00:00
- dart2js replaced its source-map implementation. There aren't any big
differences, but more data is emitted for synthetic code generated by the
compiler.
2017-12-21 04:22:52 +00:00
2021-07-09 01:34:24 +00:00
- `dart:mirrors` support was removed. Frameworks are encouraged to use
code-generation instead. Conditional imports indicate that mirrors are not
supported, and any API in the mirrors library will throw at runtime.
2017-12-21 04:22:52 +00:00
2021-07-09 01:34:24 +00:00
- The generated output of dart2js can now be run as a webworker.
2017-12-21 04:22:52 +00:00
2021-07-09 01:34:24 +00:00
- `dart:isolate` support was removed. To launch background tasks, please use
webworkers instead. APIs for webworkers can be accessed from `dart:html` or
JS-interop.
2018-02-27 23:49:46 +00:00
2021-07-09 01:34:24 +00:00
- dart2js no longer supports the `--package-root` flag. This flag was deprecated
in favor of `--packages` long ago.
2018-02-27 23:49:46 +00:00
2018-08-02 01:07:22 +00:00
### Tool Changes
2017-12-21 04:22:52 +00:00
2018-08-02 01:07:22 +00:00
#### Analyzer
2017-12-21 04:22:52 +00:00
2021-07-09 01:34:24 +00:00
- The analyzer will no longer issue a warning when a generic type parameter is
used as the type in an instance check. For example:
2017-12-21 04:22:52 +00:00
2021-07-09 01:34:24 +00:00
```dart
test< T > () {
print(3 is T); // No warning
}
```
2017-06-29 20:50:09 +00:00
2021-07-09 01:34:24 +00:00
- New static checking of `@visibleForTesting` elements. Accessing a method,
function, class, etc. annotated with `@visibleForTesting` from a file _not_ in
a `test/` directory will result in a new hint ([issue 28273][]).
2017-06-29 20:50:09 +00:00
2021-07-09 01:34:24 +00:00
- Static analysis now respects functions annotated with `@alwaysThrows` ([issue
31384][]).
2017-06-29 20:50:09 +00:00
2021-07-09 01:34:24 +00:00
- New hints added:
2017-07-06 21:16:01 +00:00
2021-07-09 01:34:24 +00:00
- `NULL_AWARE_BEFORE_OPERATOR` when an operator is used after a null-aware
access. For example:
2017-06-08 22:14:28 +00:00
2021-07-09 01:34:24 +00:00
```dart
x?.a - ''; // HINT
```
2017-09-15 22:36:44 +00:00
2021-07-09 01:34:24 +00:00
- `NULL_AWARE_IN_LOGICAL_OPERATOR` when an expression with null-aware access
is used as a condition in logical operators. For example:
2017-09-15 22:36:44 +00:00
2021-07-09 01:34:24 +00:00
```dart
x.a || x?.b; // HINT
```
2017-09-15 22:36:44 +00:00
2021-07-09 01:34:24 +00:00
- The command line analyzer (dartanalyzer) and the analysis server no longer
treat directories named `packages` specially. Previously they had ignored
these directories - and their contents - from the point of view of analysis.
Now they'll be treated just as regular directories. This special-casing of
`packages` directories was to support using symlinks for package: resolution;
that functionality is now handled by `.packages` files.
2017-09-15 22:36:44 +00:00
2021-07-09 01:34:24 +00:00
- New static checking of duplicate shown or hidden names in an export directive
([issue 33182][]).
2017-09-15 22:36:44 +00:00
2021-07-09 01:34:24 +00:00
- The analysis server will now only analyze code in Dart 2 mode ('strong mode').
It will emit warnings for analysis options files that have
`strong-mode: false` set (and will emit a hint for `strong-mode: true` , which
is no longer necessary).
2018-03-13 15:37:09 +00:00
2021-07-09 01:34:24 +00:00
- The dartanalyzer `--strong` flag is now deprecated and ignored. The
command-line analyzer now only analyzes code in strong mode.
2017-09-15 22:36:44 +00:00
2018-08-02 01:07:22 +00:00
[issue 28273]: https://github.com/dart-lang/sdk/issues/28273
[issue 31384]: https://github.com/dart-lang/sdk/issues/31384
[issue 33182]: https://github.com/dart-lang/sdk/issues/33182
2017-09-15 22:36:44 +00:00
2018-08-02 01:07:22 +00:00
#### dartfmt
2017-07-06 17:37:11 +00:00
2021-07-09 01:34:24 +00:00
- Support `assert()` in const constructor initializer lists.
2017-08-07 23:41:12 +00:00
2021-07-09 01:34:24 +00:00
- Better formatting for multi-line strings in argument lists.
2017-08-07 23:41:12 +00:00
2021-07-09 01:34:24 +00:00
- Force splitting an empty block as the then body of an if with an else.
2018-08-02 01:07:22 +00:00
2021-07-09 01:34:24 +00:00
- Support metadata annotations on enum cases.
2018-08-02 01:07:22 +00:00
2021-07-09 01:34:24 +00:00
- Add `--fix` to remove unneeded `new` and `const` keywords, and change `:` to
`=` before named parameter default values.
2018-08-02 01:07:22 +00:00
2021-07-09 01:34:24 +00:00
- Change formatting rules around static methods to uniformly format code with
and without `new` and `const` .
2018-08-02 01:07:22 +00:00
2021-07-09 01:34:24 +00:00
- Format expressions inside string interpolation.
2018-08-02 01:07:22 +00:00
#### Pub
2021-07-09 01:34:24 +00:00
- Pub has a brand new version solver! It supports all the same features as the
old version solver, but it's much less likely to stall out on difficult
package graphs, and it's much clearer about why a solution can't be found when
version solving fails.
- Remove support for transformers, `pub build` , and `pub serve` . Use the [new
build system][transformers] instead.
- There is now a default SDK constraint of `<2.0.0` for any package with no
existing upper bound. This allows us to move more safely to 2.0.0. All new
packages published on pub will now require an upper bound SDK constraint so
future major releases of Dart don't destabilize the package ecosystem.
All SDK constraint exclusive upper bounds are now treated as though they allow
pre-release versions of that upper bound. For example, the SDK constraint
`>=1.8.0 <2.0.0` now allows pre-release SDK versions such as `2.0.0-beta.3.0` .
This allows early adopters to try out packages that don't explicitly declare
support for the new version yet. You can disable this functionality by setting
the `PUB_ALLOW_PRERELEASE_SDK` environment variable to `false` .
- Allow depending on a package in a subdirectory of a Git repository. Git
dependencies may now include a `path` parameter, indicating that the package
exists in a subdirectory of the Git repository. For example:
```yaml
dependencies:
foobar:
git:
url: git://github.com/dart-lang/multi_package_repo
path: pkg/foobar
```
2017-07-06 17:37:11 +00:00
2021-07-09 01:34:24 +00:00
- Added an `--executables` option to `pub deps` command. This will list all
available executables that can be run with `pub run` .
2018-08-02 01:07:22 +00:00
2021-07-09 01:34:24 +00:00
- The Flutter `sdk` source will now look for packages in
`flutter/bin/cache/pkg/` as well as `flutter/packages/` . In particular, this
means that packages can depend on the `sky_engine` package from the `sdk`
source ([issue 1775][pub#1775]).
2018-08-02 01:07:22 +00:00
2021-07-09 01:34:24 +00:00
- Pub now caches compiled packages and snapshots in the `.dart_tool/pub`
directory, rather than the `.pub` directory ([issue 1795][pub#1795]).
2018-08-02 01:07:22 +00:00
2021-07-09 01:34:24 +00:00
- Other bug fixes and improvements.
2018-08-02 01:07:22 +00:00
[issue 30246]: https://github.com/dart-lang/sdk/issues/30246
[pub#1679]: https://github.com/dart-lang/pub/issues/1679
[pub#1684]: https://github.com/dart-lang/pub/issues/1684
[pub#1775]: https://github.com/dart-lang/pub/issues/1775
[pub#1795]: https://github.com/dart-lang/pub/issues/1795
[pub#1823]: https://github.com/dart-lang/pub/issues/1823
2018-08-10 13:42:43 +00:00
## 1.24.3 - 2017-12-14
2017-12-19 15:39:33 +00:00
2021-07-09 01:34:24 +00:00
- Fix for constructing a new SecurityContext that contains the built-in
2017-12-19 15:39:33 +00:00
certificate authority roots
2018-01-03 19:05:40 +00:00
([issue 24693](https://github.com/dart-lang/sdk/issues/24693)).
2017-12-19 15:39:33 +00:00
### Core library changes
2021-07-09 01:34:24 +00:00
- `dart:io`
- Unified backends for `SecureSocket` , `SecurityContext` , and
`X509Certificate` to be consistent across all platforms. All `SecureSocket` ,
`SecurityContext` , and `X509Certificate` properties and methods are now
supported on iOS and OSX.
2017-12-19 15:39:33 +00:00
2018-08-10 13:42:43 +00:00
## 1.24.2 - 2017-06-22
2017-06-26 14:04:51 +00:00
2021-07-09 01:34:24 +00:00
- Fixes for debugging in Dartium.
- Fix DevConsole crash with JS
2018-01-03 19:05:40 +00:00
([issue 29873](https://github.com/dart-lang/sdk/issues/29873)).
2021-07-09 01:34:24 +00:00
- Fix debugging in WebStorm, NULL returned for JS objects
2018-01-03 19:05:40 +00:00
([issue 29854](https://github.com/dart-lang/sdk/issues/29854)).
2017-06-26 14:04:51 +00:00
2018-08-10 13:42:43 +00:00
## 1.24.1 - 2017-06-14
2017-06-26 14:04:51 +00:00
2021-07-09 01:34:24 +00:00
- Bug fixes for dartdevc support in `pub serve` .
- Fixed module config invalidation logic so modules are properly recalculated
when package layout changes.
- Fixed exception when handling require.js errors that aren't script load
2017-06-26 14:04:51 +00:00
errors.
2021-07-09 01:34:24 +00:00
- Fixed an issue where requesting the bootstrap.js file before the dart.js
2017-06-26 14:04:51 +00:00
file would result in a 404.
2021-07-09 01:34:24 +00:00
- Fixed a Safari issue during bootstrapping (note that Safari is still not
2017-06-26 14:04:51 +00:00
officially supported but does work for trivial examples).
2021-07-09 01:34:24 +00:00
- Fix for a Dartium issue where there was no sound in checked mode
2018-01-03 19:05:40 +00:00
([issue 29810](https://github.com/dart-lang/sdk/issues/29810)).
2017-06-26 14:04:51 +00:00
2018-08-10 13:42:43 +00:00
## 1.24.0 - 2017-06-12
2017-03-30 10:36:02 +00:00
### Language
2021-07-09 01:34:24 +00:00
- During a dynamic type check, `void` is not required to be `null` anymore. In
practice, this makes overriding `void` functions with non-`void` functions
2017-05-08 09:31:33 +00:00
safer.
2017-06-08 00:16:10 +00:00
2021-07-09 01:34:24 +00:00
- During static analysis, a function or setter declared using `=>` with return
2017-05-22 13:58:19 +00:00
type `void` now allows the returned expression to have any type. For example,
assuming the declaration `int x;` , it is now type correct to have
`void f() => ++x;` .
2017-06-08 00:16:10 +00:00
2021-07-09 01:34:24 +00:00
- A new function-type syntax has been added to the language. **Warning** : _In
Dart 1.24, this feature is incomplete, and not stable in the Analyzer._
2017-10-09 11:19:25 +00:00
2017-05-24 16:22:53 +00:00
Intuitively, the type of a function can be constructed by textually replacing
2021-07-09 01:34:24 +00:00
the function's name with `Function` in its declaration. For instance, the type
of `void foo() {}` would be `void Function()` . The new syntax may be used
2017-05-24 16:22:53 +00:00
wherever a type can be written. It is thus now possible to declare fields
containing functions without needing to write typedefs: `void Function() x;` .
The new function type has one restriction: it may not contain the old-style
2017-06-08 00:16:10 +00:00
function-type syntax for its parameters. The following is thus illegal:
2021-07-09 01:34:24 +00:00
`void Function(int f())` . `typedefs` have been updated to support this new
syntax.
2017-06-08 00:16:10 +00:00
2017-05-24 16:22:53 +00:00
Examples:
2017-06-08 00:16:10 +00:00
```dart
2017-05-24 16:22:53 +00:00
typedef F = void Function(); // F is the name for a `void` callback.
int Function(int) f; // A field `f` that contains an int->int function.
class A< T > {
// The parameter `callback` is a function that takes a `T` and returns
// `void` .
void forEach(void Function(T) callback);
}
// The new function type supports generic arguments.
typedef Invoker = T Function< T > (T Function() callback);
```
2017-03-30 10:36:02 +00:00
### Core library changes
2021-07-09 01:34:24 +00:00
- `dart:async` , `dart:core` , `dart:io`
- Adding to a closed sink, including `IOSink` , is no longer not allowed. In
1.24, violations are only reported (on stdout or stderr), but a future
version of the Dart SDK will change this to throwing a `StateError` .
2017-06-08 00:16:10 +00:00
2021-07-09 01:34:24 +00:00
- `dart:convert`
- **BREAKING** Removed the deprecated `ChunkedConverter` class.
- JSON maps are now typed as `Map<String, dynamic>` instead of
2017-06-08 00:16:10 +00:00
`Map<dynamic, dynamic>` . A JSON-map is not a `HashMap` or `LinkedHashMap`
anymore (but just a `Map` ).
2021-07-09 01:34:24 +00:00
- `dart:io`
- Added `Platform.localeName` , needed for accessing the locale on platforms
2017-04-18 15:39:21 +00:00
that don't store it in an environment variable.
2021-07-09 01:34:24 +00:00
- Added `ProcessInfo.currentRss` and `ProcessInfo.maxRss` for inspecting the
Dart VM process current and peak resident set size.
- Added `RawSynchronousSocket` , a basic synchronous socket implementation.
2017-05-08 13:52:15 +00:00
2021-07-09 01:34:24 +00:00
- `dart:` web APIs have been updated to align with Chrome v50. This change
includes **a large number of changes** , many of which are breaking. In some
cases, new class names may conflict with names that exist in existing code.
2017-06-08 04:19:06 +00:00
2021-07-09 01:34:24 +00:00
- `dart:html`
2017-06-08 04:19:06 +00:00
2021-07-09 01:34:24 +00:00
- **REMOVED** classes: `Bluetooth` , `BluetoothDevice` ,
2017-06-08 04:19:06 +00:00
`BluetoothGattCharacteristic` , `BluetoothGattRemoteServer` ,
`BluetoothGattService` , `BluetoothUuid` , `CrossOriginConnectEvent` ,
`DefaultSessionStartEvent` , `DomSettableTokenList` , `MediaKeyError` ,
`PeriodicSyncEvent` , `PluginPlaceholderElement` , `ReadableStream` ,
`StashedMessagePort` , `SyncRegistration`
2021-07-09 01:34:24 +00:00
- **REMOVED** members:
- `texImage2DCanvas` was removed from `RenderingContext` .
- `endClip` and `startClip` were removed from `Animation` .
- `after` and `before` were removed from `CharacterData` , `ChildNode` and
2017-06-08 04:19:06 +00:00
`Element` .
2021-07-09 01:34:24 +00:00
- `keyLocation` was removed from `KeyboardEvent` . Use `location` instead.
- `generateKeyRequest` , `keyAddedEvent` , `keyErrorEvent` , `keyMessageEvent` ,
2017-06-08 04:19:06 +00:00
`mediaGroup` , `needKeyEvent` , `onKeyAdded` , `onKeyError` , `onKeyMessage` ,
and `onNeedKey` were removed from `MediaElement` .
2021-07-09 01:34:24 +00:00
- `getStorageUpdates` was removed from `Navigator`
- `status` was removed from `PermissionStatus`
- `getAvailability` was removed from `PreElement`
- Other behavior changes:
- URLs returned in CSS or html are formatted with quoted string. Like
`url("http://google.com")` instead of `url(http://google.com)` .
- Event timestamp property type changed from `int` to `num` .
- Chrome introduced slight layout changes of UI objects. In addition many
height/width dimensions are returned in subpixel values (`num` instead of
whole numbers).
- `setRangeText` with a `selectionMode` value of 'invalid' is no longer
2017-06-08 04:19:06 +00:00
valid. Only "select", "start", "end", "preserve" are allowed.
2021-07-09 01:34:24 +00:00
- `dart:svg`
2017-06-08 04:19:06 +00:00
2021-07-09 01:34:24 +00:00
- A large number of additions and removals. Review your use of `dart:svg`
2017-06-08 04:19:06 +00:00
carefully.
2021-07-09 01:34:24 +00:00
- `dart:web_audio`
2017-06-08 04:19:06 +00:00
2021-07-09 01:34:24 +00:00
- new method on `AudioContext` - `createIirFilter` returns a new class
2017-06-08 04:19:06 +00:00
`IirFilterNode` .
2021-07-09 01:34:24 +00:00
- `dart:web_gl`
2017-06-08 04:19:06 +00:00
2021-07-09 01:34:24 +00:00
- new classes: `CompressedTextureAstc` , `ExtColorBufferFloat` ,
2017-06-08 04:19:06 +00:00
`ExtDisjointTimerQuery` , and `TimerQueryExt` .
2021-07-09 01:34:24 +00:00
- `ExtFragDepth` added: `readPixels2` and `texImage2D2` .
2017-06-08 04:19:06 +00:00
#### Strong Mode
2021-07-09 01:34:24 +00:00
- Removed ad hoc `Future.then` inference in favor of using `FutureOr` . Prior to
2020-02-22 00:14:09 +00:00
adding `FutureOr` to the language, the analyzer implemented an ad hoc type
2017-06-08 04:19:06 +00:00
inference for `Future.then` (and overrides) treating it as if the onValue
2021-07-09 01:34:24 +00:00
callback was typed to return `FutureOr` for the purposes of inference. This ad
hoc inference has been removed now that `FutureOr` has been added.
2017-06-08 04:19:06 +00:00
Packages that implement `Future` must either type the `onValue` parameter to
2021-07-09 01:34:24 +00:00
`.then` as returning `FutureOr<T>` , or else must leave the type of the
parameter entirely to allow inference to fill in the type.
2017-06-08 04:19:06 +00:00
2021-07-09 01:34:24 +00:00
- During static analysis, a function or setter declared using `=>` with return
2017-06-08 04:19:06 +00:00
type `void` now allows the returned expression to have any type.
2017-03-30 10:36:02 +00:00
### Tool Changes
2021-07-09 01:34:24 +00:00
- Dartium
2017-06-08 04:19:06 +00:00
2021-07-09 01:34:24 +00:00
Dartium is now based on Chrome v50. See _Core library changes_ above for
2017-06-08 04:19:06 +00:00
details on the changed APIs.
2021-07-09 01:34:24 +00:00
- Pub
2017-06-08 22:14:28 +00:00
2021-07-09 01:34:24 +00:00
- `pub build` and `pub serve`
2017-06-13 20:24:39 +00:00
2021-07-09 01:34:24 +00:00
- Added support for the Dart Development Compiler.
2017-05-27 23:58:23 +00:00
Unlike dart2js, this new compiler is modular, which allows pub to do
incremental re-builds for `pub serve` , and potentially `pub build` in the
future.
In practice what that means is you can edit your Dart files, refresh in
Chrome (or other supported browsers), and see your edits almost
immediately. This is because pub is only recompiling your package, not all
packages that you depend on.
There is one caveat with the new compiler, which is that your package and
your dependencies must all be strong mode clean. If you are getting an
error compiling one of your dependencies, you will need to file bugs or
send pull requests to get them strong mode clean.
There are two ways of opting into the new compiler:
2021-07-09 01:34:24 +00:00
- Use the new `--web-compiler` flag, which supports `dartdevc` , `dart2js`
or `none` as options. This is the easiest way to try things out without
changing the default.
2017-05-27 23:58:23 +00:00
2021-07-09 01:34:24 +00:00
- Add config to your pubspec. There is a new `web` key which supports a
single key called `compiler` . This is a map from mode names to compiler
to use. For example, to default to dartdevc in debug mode you can add
the following to your pubspec:
2017-05-27 23:58:23 +00:00
2021-07-09 01:34:24 +00:00
```yaml
web:
compiler:
debug: dartdevc
```
2017-05-27 23:58:23 +00:00
You can also use the new compiler to run your tests in Chrome much more
quickly than you can with dart2js. In order to do that, run
`pub serve test --web-compiler=dartdevc` , and then run
`pub run test -p chrome --pub-serve=8080` .
2021-07-09 01:34:24 +00:00
- The `--no-dart2js` flag has been deprecated in favor of
2017-05-27 23:58:23 +00:00
`--web-compiler=none` .
2017-06-08 22:14:28 +00:00
2021-07-09 01:34:24 +00:00
- `pub build` will use a failing exit code if there are errors in any
2017-04-08 00:57:03 +00:00
transformer.
2017-06-08 22:14:28 +00:00
2021-07-09 01:34:24 +00:00
- `pub publish`
2017-06-13 20:24:39 +00:00
2021-07-09 01:34:24 +00:00
- Added support for the UNLICENSE file.
2017-06-08 22:14:28 +00:00
2021-07-09 01:34:24 +00:00
- Packages that depend on the Flutter SDK may be published.
2017-06-08 22:14:28 +00:00
2021-07-09 01:34:24 +00:00
- `pub get` and `pub upgrade`
2017-06-08 22:14:28 +00:00
2021-07-09 01:34:24 +00:00
- Don't dump a stack trace when a network error occurs while fetching
2017-06-08 22:14:28 +00:00
packages.
2017-04-03 18:23:55 +00:00
2021-07-09 01:34:24 +00:00
- dartfmt
- Preserve type parameters in new generic function typedef syntax.
- Add self-test validation to ensure formatter bugs do not cause user code to
be lost.
2017-04-26 21:54:05 +00:00
2017-05-22 20:35:21 +00:00
### Infrastructure changes
2021-07-09 01:34:24 +00:00
- As of this release, we'll show a warning when using the MIPS architecture.
2017-05-22 20:35:21 +00:00
Unless we learn about any critical use of Dart on MIPS in the meantime, we're
planning to deprecate support for MIPS starting with the next stable release.
2017-06-26 14:04:51 +00:00
## 1.23.0 - 2017-04-21
2017-01-30 12:26:39 +00:00
2017-03-30 21:22:19 +00:00
#### Strong Mode
2017-03-17 20:39:15 +00:00
2021-07-09 01:34:24 +00:00
- Breaking change - it is now a strong mode error if a mixin causes a name
2017-03-30 21:22:19 +00:00
conflict between two private members (field/getter/setter/method) from a
2021-07-09 01:34:24 +00:00
different library. (SDK issue
[28809 ](https://github.com/dart-lang/sdk/issues/28809 )).
2017-02-03 00:21:23 +00:00
2017-03-30 21:22:19 +00:00
lib1.dart:
2017-03-23 21:19:52 +00:00
2017-03-30 21:22:19 +00:00
```dart
class A {
int _x;
}
class B {
int _x;
}
```
lib2.dart:
```dart
import 'lib1.dart';
class C extends A with B {}
```
```
error • The private name _x, defined by B, conflicts with the same name defined by A at tmp/lib2.dart:3:24 • private_collision_in_mixin_application
```
2021-07-09 01:34:24 +00:00
- Breaking change - strong mode will prefer the expected type to infer generic
types, functions, and methods (SDK issue
[27586 ](https://github.com/dart-lang/sdk/issues/27586 )).
2017-03-28 18:30:34 +00:00
```dart
main() {
List< Object > foo = /*infers: < Object > */['hello', 'world'];
var bar = /*infers: < String > */['hello', 'world'];
}
```
2017-03-29 22:54:19 +00:00
2021-07-09 01:34:24 +00:00
- Strong mode inference error messages are improved (SDK issue
[29108 ](https://github.com/dart-lang/sdk/issues/29108 )).
2017-03-28 18:30:34 +00:00
```dart
import 'dart:math';
test(Iterable/* fix is to add < num > here */ values) {
num n = values.fold(values.first as num, max);
}
```
2021-07-09 01:34:24 +00:00
2017-03-28 18:30:34 +00:00
Now produces the error on the generic function "max":
2021-07-09 01:34:24 +00:00
2017-03-28 18:30:34 +00:00
```
Couldn't infer type parameter 'T'.
Tried to infer 'dynamic' for 'T' which doesn't work:
Function type declared as '< T extends num > (T, T) → T'
used where '(num, dynamic) → num' is required.
Consider passing explicit type argument(s) to the generic.
```
2021-07-09 01:34:24 +00:00
- Strong mode supports overriding fields, `@virtual` is no longer required (SDK
issue [28120 ](https://github.com/dart-lang/sdk/issues/28120 )).
2017-03-28 18:30:34 +00:00
2021-07-09 01:34:24 +00:00
```dart
class C {
int x = 42;
}
class D extends C {
get x {
print("x got called");
return super.x;
2017-03-28 18:30:34 +00:00
}
2021-07-09 01:34:24 +00:00
}
main() {
print(new D().x);
}
```
2017-03-28 18:30:34 +00:00
2021-07-09 01:34:24 +00:00
- Strong mode down cast composite warnings are no longer issued by default. (SDK
issue [28588 ](https://github.com/dart-lang/sdk/issues/28588 )).
2017-03-30 21:22:19 +00:00
```dart
void test() {
List untyped = [];
List< int > typed = untyped; // No down cast composite warning
}
```
2021-07-09 01:34:24 +00:00
To opt back into the warnings, add the following to the
2022-02-08 19:29:56 +00:00
[.analysis_options ](https://dart.dev/guides/language/analysis-options )
2017-03-30 21:22:19 +00:00
file for your project.
```
analyzer:
errors:
strong_mode_down_cast_composite: warning
```
### Core library changes
2021-07-09 01:34:24 +00:00
- `dart:core`
- Added `Uri.isScheme` function to check the scheme of a URI. Example:
`uri.isScheme("http")` . Ignores case when comparing.
- Make `UriData.parse` validate its input better. If the data is base-64
encoded, the data is normalized wrt. alphabet and padding, and it contains
invalid base-64 data, parsing fails. Also normalizes non-base-64 data.
- `dart:io`
- Added functions `File.lastAccessed` , `File.lastAccessedSync` ,
2017-03-30 21:22:19 +00:00
`File.setLastModified` , `File.setLastModifiedSync` , `File.setLastAccessed` ,
and `File.setLastAccessedSync` .
2021-07-09 01:34:24 +00:00
- Added `{Stdin,Stdout}.supportsAnsiEscapes` .
2017-03-30 21:22:19 +00:00
### Dart VM
2021-07-09 01:34:24 +00:00
- Calls to `print()` and `Stdout.write*()` now correctly print unicode
2017-03-30 21:22:19 +00:00
characters to the console on Windows. Calls to `Stdout.add*()` behave as
before.
2017-02-28 23:19:52 +00:00
### Tool changes
2021-07-09 01:34:24 +00:00
- Analysis
- `dartanalyzer` now follows the same rules as the analysis server to find an
analysis options file, stopping when an analysis options file is found:
- Search up the directory hierarchy looking for an analysis options file.
- If analyzing a project referencing the [Flutter ](https://flutter.io/ )
2017-03-17 20:39:15 +00:00
package, then use the
2017-02-28 23:19:52 +00:00
[default Flutter analysis options ](https://github.com/flutter/flutter/blob/master/packages/flutter/lib/analysis_options_user.yaml )
found in `package:flutter` .
2021-07-09 01:34:24 +00:00
- If in a Bazel workspace, then use the analysis options in
2017-03-17 20:39:15 +00:00
`package:dart.analysis_options/default.yaml` if it exists.
2021-07-09 01:34:24 +00:00
- Use the default analysis options rules.
- In addition, specific to `dartanalyzer` :
- an analysis options file can be specified on the command line via
2017-03-17 20:39:15 +00:00
`--options` and that file will be used instead of searching for an
analysis options file.
2021-07-09 01:34:24 +00:00
- any analysis option specified on the command line (e.g. `--strong` or
`--no-strong` ) takes precedence over any corresponding value specified in
the analysis options file.
2017-02-28 23:19:52 +00:00
2021-07-09 01:34:24 +00:00
- Dartium, dart2js, and DDC
2017-03-15 23:54:12 +00:00
2021-07-09 01:34:24 +00:00
- Imports to `dart:io` are allowed, but the imported library is not supported
2017-03-15 23:54:12 +00:00
and will likely fail on most APIs at runtime. This change was made as a
stopgap measure to make it easier to write libraries that share code between
platforms (like package `http` ). This might change again when configuration
specific imports are supported.
2017-02-28 23:19:52 +00:00
2021-07-09 01:34:24 +00:00
- Pub
- Now sends telemetry data to `pub.dartlang.org` to allow better understanding
2017-03-17 22:09:46 +00:00
of why a particular package is being accessed.
2021-07-09 01:34:24 +00:00
- `pub publish`
- Warns if a package imports a package that's not a dependency from within
2017-03-17 20:39:15 +00:00
`lib/` or `bin/` , or a package that's not a dev dependency from within
2017-03-17 22:15:10 +00:00
`benchmark/` , `example/` , `test/` or `tool/` .
2021-07-09 01:34:24 +00:00
- No longer produces "UID too large" errors on OS X. All packages are now
2017-03-17 20:39:15 +00:00
uploaded with the user and group names set to "pub".
2021-07-09 01:34:24 +00:00
- No longer fails with a stack overflow when uploading a package that uses
2017-03-17 20:39:15 +00:00
Git submodules.
2021-07-09 01:34:24 +00:00
- `pub get` and `pub upgrade`
- Produce more informative error messages if they're run directly in a
2017-03-17 20:39:15 +00:00
package that uses Flutter.
2021-07-09 01:34:24 +00:00
- Properly unlock SDK and path dependencies if they have a new version
2017-03-17 20:39:15 +00:00
that's also valid according to the user's pubspec.
2021-07-09 01:34:24 +00:00
- dartfmt
- Support new generic function typedef syntax.
- Make the precedence of cascades more visible.
- Fix a couple of places where spurious newlines were inserted.
- Correctly report unchanged formatting when reading from stdin.
- Ensure space between `-` and `--` . Code that does this is pathological, but
2017-03-29 22:54:19 +00:00
it technically meant dartfmt could change the semantics of the code.
2021-07-09 01:34:24 +00:00
- Preserve a blank line between enum cases.
- Other small formatting tweaks.
2017-06-26 14:04:51 +00:00
## 1.22.1 - 2017-02-22
Patch release, resolves two issues:
2021-07-09 01:34:24 +00:00
- Dart VM crash: [Issue 28072 ](https://github.com/dart-lang/sdk/issues/28757 )
2017-06-26 14:04:51 +00:00
2021-07-09 01:34:24 +00:00
- Dart VM bug combining types, await, and deferred loading:
[Issue 28678 ](https://github.com/dart-lang/sdk/issues/28678 )
2017-06-26 14:04:51 +00:00
2017-03-30 10:36:02 +00:00
## 1.22.0 - 2017-02-14
2016-12-08 21:17:30 +00:00
2016-12-20 13:20:59 +00:00
### Language
2021-07-09 01:34:24 +00:00
- Breaking change:
['Generalized tear-offs' ](https://github.com/gbracha/generalizedTearOffs/blob/master/proposal.md )
are no longer supported, and will cause errors. We updated the language spec
and added warnings in 1.21, and are now taking the last step to fully
de-support them. They were previously only supported in the VM, and there are
almost no known uses of them in the wild.
2016-12-30 11:11:15 +00:00
2021-07-09 01:34:24 +00:00
- The `assert()` statement has been expanded to support an optional second
`message` argument (SDK issue
[27342 ](https://github.com/dart-lang/sdk/issues/27342 )).
2016-12-20 13:20:59 +00:00
2021-07-09 01:34:24 +00:00
The message is displayed if the assert fails. It can be any object, and it is
accessible as `AssertionError.message` . It can be used to provide more user
friendly exception outputs. As an example, the following assert:
2016-12-20 13:20:59 +00:00
2021-07-09 01:34:24 +00:00
```dart
assert(configFile != null, "Tool config missing. Please see https://goo.gl/k8iAi for details.");
```
2016-12-20 13:20:59 +00:00
2021-07-09 01:34:24 +00:00
would produce the following exception output:
2016-12-20 13:20:59 +00:00
2021-07-09 01:34:24 +00:00
```
Unhandled exception:
'file:///Users/mit/tmp/tool/bin/main.dart': Failed assertion: line 9 pos 10:
'configFile != null': Tool config missing. Please see https://goo.gl/k8iAi for details.
#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:33)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:29)
#2 main (file:///Users/mit/tmp/tool/bin/main.dart:9:10)
```
2016-12-20 13:20:59 +00:00
2021-07-09 01:34:24 +00:00
- The `Null` type has been moved to the bottom of the type hierarchy. As such,
it is considered a subtype of every other type. The `null` _literal_ was
always treated as a bottom type. Now the named class `Null` is too:
2017-01-19 14:18:23 +00:00
2021-07-09 01:34:24 +00:00
```dart
const empty = < Null > [];
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
String concatenate(List< String > parts) => parts.join();
int sum(List< int > numbers) => numbers.fold(0, (sum, n) => sum + n);
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
concatenate(empty); // OK.
sum(empty); // OK.
```
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
- Introduce `covariant` modifier on parameters. It indicates that the parameter
(and the corresponding parameter in any method that overrides it) has looser
override rules. In strong mode, these require a runtime type check to maintain
soundness, but enable an architectural pattern that is useful in some code.
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
It lets you specialize a family of classes together, like so:
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
```dart
abstract class Predator {
void chaseAndEat(covariant Prey p);
}
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
abstract class Prey {}
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
class Mouse extends Prey {}
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
class Seal extends Prey {}
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
class Cat extends Predator {
void chaseAndEat(Mouse m) => ...
}
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
class Orca extends Predator {
void chaseAndEat(Seal s) => ...
}
```
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
This isn't statically safe, because you could do:
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
```dart
Predator predator = new Cat(); // Upcast.
predator.chaseAndEat(new Seal()); // Cats can't eat seals!
```
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
To preserve soundness in strong mode, in the body of a method that uses a
covariant override (here, `Cat.chaseAndEat()` ), the compiler automatically
inserts a check that the parameter is of the expected type. So the compiler
gives you something like:
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
```dart
class Cat extends Predator {
void chaseAndEat(o) {
var m = o as Mouse;
...
2017-01-30 16:11:04 +00:00
}
2021-07-09 01:34:24 +00:00
}
```
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
Spec mode allows this unsound behavior on all parameters, even though users
rarely rely on it. Strong mode disallowed it initially. Now, strong mode lets
you opt into this behavior in the places where you do want it by using this
modifier. Outside of strong mode, the modifier is ignored.
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
- Change instantiate-to-bounds rules for generic type parameters when running in
strong mode. If you leave off the type parameters from a generic type, we need
to decide what to fill them in with. Dart 1.0 says just use `dynamic` , but
that isn't sound:
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
```dart
class Abser< T extends num > {
void absThis(T n) { n.abs(); }
}
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
var a = new Abser(); // Abser< dynamic > .
a.absThis("not a num");
```
2017-01-19 14:18:23 +00:00
2021-07-09 01:34:24 +00:00
We want the body of `absThis()` to be able to safely assume `n` is at least a
`num` -- that's why there's a constraint on T, after all. Implicitly using
`dynamic` as the type parameter in this example breaks that.
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
Instead, strong mode uses the bound. In the above example, it fills it in with
`num` , and then the second line where a string is passed becomes a static
error.
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
However, there are some cases where it is hard to figure out what that default
bound should be:
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
```dart
class RuhRoh< T extends Comparable < T > > {}
```
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
Strong mode's initial behavior sometimes produced surprising, unintended
results. For 1.22, we take a simpler approach and then report an error if a
good default type argument can't be found.
2017-01-30 16:11:04 +00:00
### Core libraries
2021-07-09 01:34:24 +00:00
- Define `FutureOr<T>` for code that works with either a future or an immediate
value of some type. For example, say you do a lot of text manipulation, and
you want a handy function to chain a bunch of them:
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
```dart
typedef String StringSwizzler(String input);
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
String swizzle(String input, List< StringSwizzler > swizzlers) {
var result = input;
for (var swizzler in swizzlers) {
result = swizzler(result);
2017-01-30 16:11:04 +00:00
}
2017-01-19 14:18:23 +00:00
2021-07-09 01:34:24 +00:00
return result;
}
```
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
This works fine:
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
```dart
main() {
var result = swizzle("input", [
(s) => s.toUpperCase(),
(s) => () => s * 2)
]);
print(result); // "INPUTINPUT".
}
```
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
Later, you realize you'd also like to support swizzlers that are asynchronous
(maybe they look up synonyms for words online). You could make your API
strictly asynchronous, but then users of simple synchronous swizzlers have to
manually wrap the return value in a `Future.value()` . Ideally, your
`swizzle()` function would be "polymorphic over asynchrony". It would allow
both synchronous and asynchronous swizzlers. Because `await` accepts immediate
values, it is easy to implement this dynamically:
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
```dart
Future< String > swizzle(String input, List< StringSwizzler > swizzlers) async {
var result = input;
for (var swizzler in swizzlers) {
result = await swizzler(result);
2017-01-30 16:11:04 +00:00
}
2021-07-09 01:34:24 +00:00
return result;
}
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
main() async {
var result = swizzle("input", [
(s) => s.toUpperCase(),
(s) => new Future.delayed(new Duration(milliseconds: 40), () => s * 2)
]);
print(await result);
}
```
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
What should the declared return type on StringSwizzler be? In the past, you
had to use `dynamic` or `Object` , but that doesn't tell the user much. Now,
you can do:
```dart
typedef FutureOr< String > StringSwizzler(String input);
```
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
Like the name implies, `FutureOr<String>` is a union type. It can be a
`String` or a `Future<String>` , but not anything else. In this case, that's
not super useful beyond just stating a more precise type for readers of the
code. It does give you a little better error checking in code that uses the
result of that.
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
`FutureOr<T>` becomes really important in _generic_ methods like
`Future.then()` . In those cases, having the type system understand this
magical union type helps type inference figure out the type argument of
`then()` based on the closure you pass it.
2017-01-30 16:11:04 +00:00
2021-07-09 01:34:24 +00:00
Previously, strong mode had hard-coded rules for handling `Future.then()`
specifically. `FutureOr<T>` exposes that functionality so third-party APIs can
take advantage of it too.
2017-01-30 16:11:04 +00:00
2016-12-08 21:17:30 +00:00
### Tool changes
2021-07-09 01:34:24 +00:00
- Dart2Js
2016-12-14 20:57:35 +00:00
2021-07-09 01:34:24 +00:00
- Remove support for (long-time deprecated) mixin typedefs.
2016-12-14 20:57:35 +00:00
2021-07-09 01:34:24 +00:00
- Pub
2016-12-08 21:17:30 +00:00
2021-07-09 01:34:24 +00:00
- Avoid using a barback asset server for executables unless they actually use
2016-12-08 21:17:30 +00:00
transformers. This makes precompilation substantially faster, produces
better error messages when precompilation fails, and allows
globally-activated executables to consistently use the
`Isolate.resolvePackageUri()` API.
2021-07-09 01:34:24 +00:00
- On Linux systems, always ignore packages' original file owners and
2016-12-08 21:17:30 +00:00
permissions when extracting those packages. This was already the default
under most circumstances.
2021-07-09 01:34:24 +00:00
- Properly close the standard input stream of child processes started using
2016-12-08 21:17:30 +00:00
`pub run` .
2021-07-09 01:34:24 +00:00
- Handle parse errors from the package cache more gracefully. A package whose
2016-12-08 21:17:30 +00:00
pubspec can't be parsed will now be ignored by `pub get --offline` and
deleted by `pub cache repair` .
2021-07-09 01:34:24 +00:00
- Make `pub run` run executables in spawned isolates. This lets them handle
2017-01-13 21:12:22 +00:00
signals and use standard IO reliably.
2016-12-13 13:04:06 +00:00
2021-07-09 01:34:24 +00:00
- Fix source-maps produced by dart2js when running in `pub serve` : URL
2017-01-28 00:48:58 +00:00
references to assets from packages match the location where `pub serve`
serves them (`packages/package_name/` instead of
`../packages/package_name/` ).
2017-01-20 19:00:51 +00:00
### Infrastructure changes
2021-07-09 01:34:24 +00:00
- The SDK now uses GN rather than gyp to generate its build files, which will
now be exclusively ninja flavored. Documentation can be found on our
[wiki ](https://github.com/dart-lang/sdk/wiki/Building-with-GN ). Also see the
help message of `tools/gn.py` . This change is in response to the deprecation
of gyp. Build file generation with gyp will continue to be available in this
release by setting the environment variable `DART_USE_GYP` before running
`gclient sync` or `gclient runhooks` , but this will be removed in a future
release.
2017-01-20 19:00:51 +00:00
2017-06-26 14:04:51 +00:00
## 1.21.1 - 2017-01-13
Patch release, resolves one issue:
2021-07-09 01:34:24 +00:00
- Dart VM: Snapshots of generic functions fail.
[Issue 28072 ](https://github.com/dart-lang/sdk/issues/28072 )
2017-06-26 14:04:51 +00:00
2016-12-07 17:03:20 +00:00
## 1.21.0 - 2016-12-07
2016-09-30 09:49:21 +00:00
2016-10-14 09:34:53 +00:00
### Language
2021-07-09 01:34:24 +00:00
- Support generic method syntax. Type arguments are not available at runtime.
For details, check the
2016-11-30 12:36:02 +00:00
[informal specification ](https://gist.github.com/eernstg/4353d7b4f669745bed3a5423e04a453c ).
2021-07-09 01:34:24 +00:00
- Support access to initializing formals, e.g., the use of `x` to initialize `y`
in `class C { var x, y; C(this.x): y = x; }` . Please check the
2016-11-30 10:47:03 +00:00
[informal specification ](https://gist.github.com/eernstg/cff159be9e34d5ea295d8c24b1a3e594 )
for details.
2021-07-09 01:34:24 +00:00
- Don't warn about switch case fallthrough if the case ends in a `rethrow`
statement. (SDK issue [27650 ](https://github.com/dart-lang/sdk/issues/27650 ))
- Also don't warn if the entire switch case is wrapped in braces - as long as
2016-11-02 13:31:04 +00:00
the block ends with a `break` , `continue` , `rethrow` , `return` or `throw` .
2021-07-09 01:34:24 +00:00
- Allow `=` as well as `:` as separator for named parameter default values.
2016-10-14 09:34:53 +00:00
2016-12-15 11:09:39 +00:00
```dart
enableFlags({bool hidden: false}) { … }
```
can now be replaced by
```dart
enableFlags({bool hidden = false}) { … }
```
(SDK issue [27559 ](https://github.com/dart-lang/sdk/issues/27559 ))
2016-10-31 19:32:23 +00:00
### Core library changes
2021-07-09 01:34:24 +00:00
- `dart:core` : `Set.difference` now takes a `Set<Object>` as argument. (SDK
2016-12-15 11:09:39 +00:00
issue [27573 ](https://github.com/dart-lang/sdk/issues/27573 ))
2016-10-31 19:32:23 +00:00
2021-07-09 01:34:24 +00:00
- `dart:developer`
2016-12-02 18:28:42 +00:00
2021-07-09 01:34:24 +00:00
- Added `Service` class.
- Allows inspecting and controlling the VM service protocol HTTP server.
- Provides an API to access the ID of an `Isolate` .
2016-10-31 19:32:23 +00:00
2016-11-07 18:41:23 +00:00
### Tool changes
2021-07-09 01:34:24 +00:00
- Dart Dev Compiler
2016-11-07 18:41:23 +00:00
2021-07-09 01:34:24 +00:00
- Support calls to `loadLibrary()` on deferred libraries. Deferred libraries
2016-12-15 11:09:39 +00:00
are still loaded eagerly. (SDK issue
[27343 ](https://github.com/dart-lang/sdk/issues/27343 ))
2016-11-07 18:41:23 +00:00
2016-10-17 12:04:33 +00:00
## 1.20.1 - 2016-10-13
Patch release, resolves one issue:
2021-07-09 01:34:24 +00:00
- Dartium: Fixes a bug that caused crashes. No issue filed.
2016-10-17 12:04:33 +00:00
2016-11-05 00:37:13 +00:00
### Strong Mode
2021-07-09 01:34:24 +00:00
- It is no longer a warning when casting from dynamic to a composite type (SDK
issue [27766 ](https://github.com/dart-lang/sdk/issues/27766 )).
2016-11-05 00:37:13 +00:00
2021-07-09 01:34:24 +00:00
```dart
main() {
dynamic obj = < int > [1, 2, 3];
// This is now allowed without a warning.
List< int > list = obj;
}
```
2016-11-05 00:37:13 +00:00
2016-10-17 12:04:33 +00:00
## 1.20.0 - 2016-10-11
2016-08-18 12:09:20 +00:00
2016-08-30 16:31:47 +00:00
### Dart VM
2021-07-09 01:34:24 +00:00
- We have improved the way that the VM locates the native code library for a
2016-08-30 16:31:47 +00:00
native extension (e.g. `dart-ext:` import). We have updated this
2022-02-08 19:29:56 +00:00
[article on native extensions ](https://dart.dev/server/c-interop-native-extensions )
2016-08-30 16:31:47 +00:00
to reflect the VM's improved behavior.
2021-07-09 01:34:24 +00:00
- Linux builds of the VM will now use the `tcmalloc` library for memory
2016-09-16 16:30:45 +00:00
allocation. This has the advantages of better debugging and profiling support
and faster small allocations, with the cost of slightly larger initial memory
footprint, and slightly slower large allocations.
2021-07-09 01:34:24 +00:00
- We have improved the way the VM searches for trusted root certificates for
2016-09-16 16:08:51 +00:00
secure socket connections on Linux. First, the VM will look for trusted root
certificates in standard locations on the file system
2016-09-28 18:35:45 +00:00
(`/etc/pki/tls/certs/ca-bundle.crt` followed by `/etc/ssl/certs` ), and only if
2016-09-16 16:08:51 +00:00
these do not exist will it fall back on the builtin trusted root certificates.
This behavior can be overridden on Linux with the new flags
2016-09-28 18:35:45 +00:00
`--root-certs-file` and `--root-certs-cache` . The former is the path to a file
2016-09-16 16:08:51 +00:00
containing the trusted root certificates, and the latter is the path to a
directory containing root certificate files hashed using `c_rehash` .
2021-07-09 01:34:24 +00:00
- The VM now throws a catchable `Error` when method compilation fails. This
allows easier debugging of syntax errors, especially when testing. (SDK issue
2016-12-15 11:09:39 +00:00
[23684 ](https://github.com/dart-lang/sdk/issues/23684 ))
2016-09-28 18:35:45 +00:00
2016-08-18 12:09:20 +00:00
### Core library changes
2016-09-23 20:56:57 +00:00
2021-07-09 01:34:24 +00:00
- `dart:core` : Remove deprecated `Resource` class. Use the class in
`package:resource` instead.
- `dart:async`
- `Future.wait` now catches synchronous errors and returns them in the
returned Future. (SDK issue
2016-12-15 11:09:39 +00:00
[27249 ](https://github.com/dart-lang/sdk/issues/27249 ))
2021-07-09 01:34:24 +00:00
- More aggressively returns a `Future` on `Stream.cancel` operations.
Discourages to return `null` from `cancel` . (SDK issue
2016-12-15 11:09:39 +00:00
[26777 ](https://github.com/dart-lang/sdk/issues/26777 ))
2021-07-09 01:34:24 +00:00
- Fixes a few bugs where the cancel future wasn't passed through
2016-09-05 15:41:22 +00:00
transformations.
2021-07-09 01:34:24 +00:00
- `dart:io`
- Added `WebSocket.addUtf8Text` to allow sending a pre-encoded text message
without a round-trip UTF-8 conversion. (SDK issue
2016-12-15 11:09:39 +00:00
[27129 ](https://github.com/dart-lang/sdk/issues/27129 ))
2016-08-18 12:09:20 +00:00
2016-09-16 16:08:51 +00:00
### Strong Mode
2016-09-01 20:38:09 +00:00
2021-07-09 01:34:24 +00:00
- Breaking change - it is an error if a generic type parameter cannot be
inferred (SDK issue [26992 ](https://github.com/dart-lang/sdk/issues/26992 )).
2016-09-01 20:38:09 +00:00
2021-07-09 01:34:24 +00:00
```dart
class Cup< T > {
Cup(T t);
}
main() {
// Error because:
// - if we choose Cup< num > it is not assignable to `cOfInt` ,
// - if we choose Cup< int > then `n` is not assignable to int.
num n;
C< int > cOfInt = new C(n);
}
```
2016-09-01 20:38:09 +00:00
2021-07-09 01:34:24 +00:00
- New feature - use `@checked` to override a method and tighten a parameter type
(SDK issue [25578 ](https://github.com/dart-lang/sdk/issues/25578 )).
2016-09-14 00:26:24 +00:00
2021-07-09 01:34:24 +00:00
```dart
import 'package:meta/meta.dart' show checked;
class View {
addChild(View v) {}
}
class MyView extends View {
// this override is legal, it will check at runtime if we actually
// got a MyView.
addChild(@checked MyView v) {}
}
main() {
dynamic mv = new MyView();
mv.addChild(new View()); // runtime error
}
```
2016-09-14 00:26:24 +00:00
2021-07-09 01:34:24 +00:00
- New feature - use `@virtual` to allow field overrides in strong mode (SDK
issue [27384 ](https://github.com/dart-lang/sdk/issues/27384 )).
2016-09-19 16:45:24 +00:00
2021-07-09 01:34:24 +00:00
```dart
import 'package:meta/meta.dart' show virtual;
class Base {
@virtual int x;
}
class Derived extends Base {
int x;
2016-09-19 16:45:24 +00:00
2021-07-09 01:34:24 +00:00
// Expose the hidden storage slot:
int get superX => super.x;
set superX(int v) { super.x = v; }
}
```
2016-09-19 16:45:24 +00:00
2021-07-09 01:34:24 +00:00
- Breaking change - infer list and map literals from the context type as well as
their values, consistent with generic methods and instance creation (SDK issue
[27151 ](https://github.com/dart-lang/sdk/issues/27151 )).
2016-09-16 23:06:19 +00:00
2021-07-09 01:34:24 +00:00
```dart
import 'dart:async';
main() async {
var b = new Future< B > .value(new B());
var c = new Future< C > .value(new C());
var/*infer List< Future < A > >*/ list = [b, c];
var/*infer List< A > */ result = await Future.wait(list);
}
class A {}
class B extends A {}
class C extends A {}
```
2016-09-16 23:06:19 +00:00
2016-09-23 20:56:57 +00:00
### Tool changes
2021-07-09 01:34:24 +00:00
- `dartfmt` - upgraded to v0.2.10
- Don't crash on annotations before parameters with trailing commas.
- Always split enum declarations if they end in a trailing comma.
- Add `--set-exit-if-changed` to set the exit code on a change.
2016-09-23 20:56:57 +00:00
2021-07-09 01:34:24 +00:00
- Pub
- Pub no longer generates a `packages/` directory by default. Instead, it
generates a `.packages` file, called a package spec. To generate a
`packages/` directory in addition to the package spec, use the
2016-09-29 12:01:13 +00:00
`--packages-dir` flag with `pub get` , `pub upgrade` , and `pub downgrade` .
2021-07-09 01:34:24 +00:00
See the
[Good-bye symlinks ](http://news.dartlang.org/2016/10/good-bye-symlinks.html )
article for details.
2016-09-29 12:01:13 +00:00
2016-10-17 12:04:33 +00:00
## 1.19.1 - 2016-09-08
Patch release, resolves one issue:
2021-07-09 01:34:24 +00:00
- Dartdoc: Fixes a bug that prevented generation of docs. (Dartdoc issue
[1233 ](https://github.com/dart-lang/dartdoc/issues/1233 ))
2016-10-17 12:04:33 +00:00
## 1.19.0 - 2016-08-26
2016-08-01 21:04:13 +00:00
2016-08-08 08:42:15 +00:00
### Language changes
2021-07-09 01:34:24 +00:00
- The language now allows a trailing comma after the last argument of a call and
the last parameter of a function declaration. This can make long argument or
parameter lists easier to maintain, as commas can be left as-is when
reordering lines. For details, see SDK issue
[26644 ](https://github.com/dart-lang/sdk/issues/26644 ).
2016-08-08 08:42:15 +00:00
2016-08-17 17:48:58 +00:00
### Tool Changes
2021-07-09 01:34:24 +00:00
- `dartfmt` - upgraded to v0.2.9+1
2016-08-17 17:48:58 +00:00
2021-07-09 01:34:24 +00:00
- Support trailing commas in argument and parameter lists.
- Gracefully handle read-only files.
- About a dozen other bug fixes.
2016-08-17 17:54:48 +00:00
2021-07-09 01:34:24 +00:00
- Pub
- Added a `--no-packages-dir` flag to `pub get` , `pub upgrade` , and
`pub downgrade` . When this flag is passed, pub will not generate a
`packages/` directory, and will remove that directory and any symlinks to it
if they exist. Note that this replaces the unsupported
`--no-package-symlinks` flag.
- Added the ability for packages to declare a constraint on the [Flutter][]
2016-08-17 17:48:58 +00:00
SDK:
```yaml
environment:
flutter: ^0.1.2
sdk: >=1.19.0 < 2.0.0
```
A Flutter constraint will only be satisfiable when pub is running in the
context of the `flutter` executable, and when the Flutter SDK version
matches the constraint.
2021-07-09 01:34:24 +00:00
- Added `sdk` as a new package source that fetches packages from a hard-coded
2016-08-17 17:48:58 +00:00
SDK. Currently only the `flutter` SDK is supported:
```yaml
dependencies:
flutter_driver:
sdk: flutter
version: ^0.0.1
```
A Flutter `sdk` dependency will only be satisfiable when pub is running in
the context of the `flutter` executable, and when the Flutter SDK contains a
package with the given name whose version matches the constraint.
2021-07-09 01:34:24 +00:00
- `tar` files on Linux are now created with `0` as the user and group IDs.
2016-08-17 17:48:58 +00:00
This fixes a crash when publishing packages while using Active Directory.
2021-07-09 01:34:24 +00:00
- Fixed a bug where packages from a hosted HTTP URL were considered the same
2016-08-17 17:48:58 +00:00
as packages from an otherwise-identical HTTPS URL.
2021-07-09 01:34:24 +00:00
- Fixed timer formatting for timers that lasted longer than a minute.
2016-08-04 12:45:01 +00:00
2021-07-09 01:34:24 +00:00
- Eliminate some false negatives when determining whether global executables
2016-08-17 17:48:58 +00:00
are on the user's executable path.
2021-07-09 01:34:24 +00:00
- `dart2js`
- `dart2dart` (aka `dart2js --output-type=dart` ) has been removed (this was
deprecated in Dart 1.11).
2016-08-17 17:48:58 +00:00
2021-07-09 01:34:24 +00:00
[flutter]: https://flutter.io/
2016-08-17 17:48:58 +00:00
### Dart VM
2021-07-09 01:34:24 +00:00
- The dependency on BoringSSL has been rolled forward. Going forward, builds of
the Dart VM including secure sockets will require a compiler with C++11
support. For details, see the
[Building wiki page ](https://github.com/dart-lang/sdk/wiki/Building ).
2016-08-04 12:45:01 +00:00
2016-08-05 15:51:44 +00:00
### Strong Mode
2016-08-05 14:25:14 +00:00
2021-07-09 01:34:24 +00:00
- New feature - an option to disable implicit casts (SDK issue
[26583 ](https://github.com/dart-lang/sdk/issues/26583 )), see the
[documentation ](https://github.com/dart-lang/dev_compiler/blob/master/doc/STATIC_SAFETY.md#disable-implicit-casts )
for usage instructions and examples.
2016-08-05 15:51:44 +00:00
2021-07-09 01:34:24 +00:00
- New feature - an option to disable implicit dynamic (SDK issue
[25573 ](https://github.com/dart-lang/sdk/issues/25573 )), see the
[documentation ](https://github.com/dart-lang/dev_compiler/blob/master/doc/STATIC_SAFETY.md#disable-implicit-dynamic )
for usage instructions and examples.
2016-08-05 15:51:44 +00:00
2021-07-09 01:34:24 +00:00
- Breaking change - infer generic type arguments from the constructor invocation
arguments (SDK issue [25220 ](https://github.com/dart-lang/sdk/issues/25220 )).
2016-08-05 14:25:14 +00:00
2021-07-09 01:34:24 +00:00
```dart
var map = new Map< String , String > ();
2016-08-05 14:25:14 +00:00
2021-07-09 01:34:24 +00:00
// infer: Map< String , String >
var otherMap = new Map.from(map);
```
2016-08-05 14:25:14 +00:00
2021-07-09 01:34:24 +00:00
- Breaking change - infer local function return type (SDK issue
[26414 ](https://github.com/dart-lang/sdk/issues/26414 )).
2016-08-05 14:25:14 +00:00
2021-07-09 01:34:24 +00:00
```dart
void main() {
// infer: return type is int
f() { return 40; }
int y = f() + 2; // type checks
print(y);
}
```
2016-08-05 14:25:14 +00:00
2021-07-09 01:34:24 +00:00
- Breaking change - allow type promotion from a generic type parameter (SDK
issue [26414 ](https://github.com/dart-lang/sdk/issues/26965 )).
2016-08-05 15:51:44 +00:00
2021-07-09 01:34:24 +00:00
```dart
void fn/*< T > */(/*=T*/ object) {
if (object is String) {
// Treat `object` as `String` inside this block.
// But it will require a cast to pass it to something that expects `T` .
print(object.substring(1));
2016-08-05 15:51:44 +00:00
}
2021-07-09 01:34:24 +00:00
}
```
2016-08-05 15:51:44 +00:00
2021-07-09 01:34:24 +00:00
- Breaking change - smarter inference for Future.then (SDK issue
[25944 ](https://github.com/dart-lang/sdk/issues/25944 )). Previous workarounds
that use async/await or `.then/*<Future<SomeType>>*/` should no longer be
necessary.
2016-08-10 19:40:37 +00:00
2021-07-09 01:34:24 +00:00
```dart
// This will now infer correctly.
Future< List < int > > t2 = f.then((_) => [3]);
// This infers too.
Future< int > t2 = f.then((_) => new Future.value(42));
```
2016-08-10 19:40:37 +00:00
2021-07-09 01:34:24 +00:00
- Breaking change - smarter inference for async functions (SDK issue
[25322 ](https://github.com/dart-lang/sdk/issues/25322 )).
2016-08-10 19:40:37 +00:00
2021-07-09 01:34:24 +00:00
```dart
void test() async {
List< int > x = await [4]; // was previously inferred
List< int > y = await new Future.value([4]); // now inferred too
}
```
2016-08-10 19:40:37 +00:00
2021-07-09 01:34:24 +00:00
- Breaking change - sideways casts are no longer allowed (SDK issue
[26120 ](https://github.com/dart-lang/sdk/issues/26120 )).
2016-08-12 21:32:36 +00:00
2016-08-03 11:33:41 +00:00
## 1.18.1 - 2016-08-02
Patch release, resolves two issues and improves performance:
2021-07-09 01:34:24 +00:00
- Debugger: Fixes a bug that crashes the VM (SDK issue
[26941 ](https://github.com/dart-lang/sdk/issues/26941 ))
2016-08-03 11:33:41 +00:00
2021-07-09 01:34:24 +00:00
- VM: Fixes an optimizer bug involving closures, try, and await (SDK issue
[26948 ](https://github.com/dart-lang/sdk/issues/26948 ))
2016-08-03 11:33:41 +00:00
2021-07-09 01:34:24 +00:00
- Dart2js: Speeds up generated code on Firefox
(https://codereview.chromium.org/2180533002)
2016-08-03 11:33:41 +00:00
## 1.18.0 - 2016-07-27
2016-06-13 14:58:09 +00:00
### Core library changes
2021-07-09 01:34:24 +00:00
- `dart:core`
- Improved performance when parsing some common URIs.
- Fixed bug in `Uri.resolve` (SDK issue
[26804 ](https://github.com/dart-lang/sdk/issues/26804 )).
- `dart:io`
- Adds file locking modes `FileLock.BLOCKING_SHARED` and
2016-06-13 14:58:09 +00:00
`FileLock.BLOCKING_EXCLUSIVE` .
2016-06-10 17:35:40 +00:00
## 1.17.1 - 2016-06-10
Patch release, resolves two issues:
2021-07-09 01:34:24 +00:00
- VM: Fixes a bug that caused crashes in async functions. (SDK issue
[26668 ](https://github.com/dart-lang/sdk/issues/26668 ))
2016-06-10 17:35:40 +00:00
2021-07-09 01:34:24 +00:00
- VM: Fixes a bug that caused garbage collection of reachable weak properties.
(https://codereview.chromium.org/2041413005)
2016-06-10 17:35:40 +00:00
2016-06-09 12:32:40 +00:00
## 1.17.0 - 2016-06-08
2016-04-21 12:01:48 +00:00
### Core library changes
2016-05-11 14:15:31 +00:00
2021-07-09 01:34:24 +00:00
- `dart:convert`
- Deprecate `ChunkedConverter` which was erroneously added in 1.16.
2016-04-21 12:01:48 +00:00
2021-07-09 01:34:24 +00:00
- `dart:core`
- `Uri.replace` supports iterables as values for the query parameters.
- `Uri.parseIPv6Address` returns a `Uint8List` .
- `dart:io`
- Added `NetworkInterface.listSupported` , which is `true` when
2016-04-26 14:48:58 +00:00
`NetworkInterface.list` is supported, and `false` otherwise. Currently,
`NetworkInterface.list` is not supported on Android.
2016-05-05 23:09:51 +00:00
### Tool Changes
2021-07-09 01:34:24 +00:00
- Pub
- TAR files created while publishing a package on Mac OS and Linux now use a
2016-05-05 23:09:51 +00:00
more portable format.
2021-07-09 01:34:24 +00:00
- Errors caused by invalid arguments now print the full usage information for
2016-05-05 23:09:51 +00:00
the command.
2021-07-09 01:34:24 +00:00
- SDK constraints for dependency overrides are no longer considered when
2016-05-05 23:09:51 +00:00
determining the total SDK constraint for a lockfile.
2021-07-09 01:34:24 +00:00
- A bug has been fixed in which a lockfile was considered up-to-date when it
2016-05-05 23:09:51 +00:00
actually wasn't.
2021-07-09 01:34:24 +00:00
- A bug has been fixed in which `pub get --offline` would crash when a
2016-05-17 21:56:10 +00:00
prerelease version was selected.
2021-07-09 01:34:24 +00:00
- Dartium and content shell
- Debugging Dart code inside iframes improved, was broken.
2016-06-06 21:31:00 +00:00
## 1.16.1 - 2016-05-24
Patch release, resolves one issue:
2021-07-09 01:34:24 +00:00
- VM: Fixes a bug that caused intermittent hangs on Windows. (SDK issue
[26400 ](https://github.com/dart-lang/sdk/issues/26400 ))
2016-06-06 21:31:00 +00:00
## 1.16.0 - 2016-04-26
2016-01-21 11:58:24 +00:00
Fix core lib DateTime in the VM (fixes #19923).
Symptom of the problem:
Set your Linux workstation (or Mac or MIPS board) to the Europe/London timezone
and the corelib/date_time test will fail, claiming that 1/1/1970 was a Wednesday
(it was actually a Thursday, trust me, I was already born).
Problem:
The implementation of DateTime in the VM relies on Unix time_t, the number of
seconds since the Epoch (1/1/1970 UTC). When asked for the weekday of a given
time, our implementation limits itself to a 32-bit positive range of time_t.
If the time falls outside of this range, the implementation picks an equivalent
time in the valid range with the same weekday, also in leap year or not, etc...
The issue is that DateTime is using the underlying OS in an inconsistent manner.
Let's take the example above: 1/1/1970 in the Europe/London timezone.
First, the number of seconds since the Epoch in UTC is calculated, here 0.
Then, the timezone offset at the given time is calculated using the underlying
OS. In this case, an historical deviation is taken into account. Indeed, London
stayed on British Summer Time between 27 October 1968 and 31 October 1971. See
https://en.wikipedia.org/wiki/British_Summer_Time#Periods_of_deviation for
details.
Our resulting time is therefore negative (one hour difference with UTC).
When asked about the weekday of this time, the implementation notices that the
time is not in the positive range and picks an "equivalent" time in the future.
It then asks the underlying OS about the timezone offset for this time, which
is 0 (usually no daylight saving time in January in London). Unfortunately,
this time is not really equivalent, because it ignores the original historical
deviation. The result is wrongly equivalent to 12/31/1969 23:00 in London, i.e.
a Wednesday, and not a Thursday as expected.
Solution:
We should use the underlying OS in a consistent way, by simply allowing the
value of time_t passed to the underlying OS to be negative, which is legal.
R=floitsch@google.com, rmacnak@google.com
Review URL: https://codereview.chromium.org/1845483002 .
2016-03-30 17:09:58 +00:00
### Core library changes
2021-07-09 01:34:24 +00:00
- `dart:convert`
- Added `BASE64URL` codec and corresponding `Base64Codec.urlSafe` constructor.
2016-04-13 22:35:27 +00:00
2021-07-09 01:34:24 +00:00
- Introduce `ChunkedConverter` and deprecate chunked methods on `Converter` .
2016-04-13 22:35:27 +00:00
2021-07-09 01:34:24 +00:00
- `dart:html`
2016-04-25 21:43:43 +00:00
There have been a number of **BREAKING** changes to align APIs with recent
changes in Chrome. These include:
2021-07-09 01:34:24 +00:00
- Chrome's `ShadowRoot` interface no longer has the methods `getElementById` ,
2016-04-25 21:43:43 +00:00
`getElementsByClassName` , and `getElementsByTagName` , e.g.,
```dart
elem.shadowRoot.getElementsByClassName('clazz')
```
should become:
```dart
elem.shadowRoot.querySelectorAll('.clazz')
```
2021-07-09 01:34:24 +00:00
- The `clipboardData` property has been removed from `KeyEvent` and `Event` .
It has been moved to the new `ClipboardEvent` class, which is now used by
`copy` , `cut` , and `paste` events.
2016-04-25 21:43:43 +00:00
2021-07-09 01:34:24 +00:00
- The `layer` property has been removed from `KeyEvent` and `UIEvent` . It has
been moved to `MouseEvent` .
2016-04-25 21:43:43 +00:00
2021-07-09 01:34:24 +00:00
- The `Point get page` property has been removed from `UIEvent` . It still
exists on `MouseEvent` and `Touch` .
2016-04-25 21:43:43 +00:00
There have also been a number of other additions and removals to `dart:html` ,
`dart:indexed_db` , `dart:svg` , `dart:web_audio` , and `dart:web_gl` that
correspond to changes to Chrome APIs between v39 and v45. Many of the breaking
changes represent APIs that would have caused runtime exceptions when compiled
2023-01-26 09:12:41 +00:00
to JavaScript and run on recent Chrome releases.
2016-04-25 21:43:43 +00:00
2021-07-09 01:34:24 +00:00
- `dart:io`
- Added `SecurityContext.alpnSupported` , which is true if a platform supports
ALPN, and false otherwise.
2016-04-01 14:49:09 +00:00
2016-04-25 21:43:43 +00:00
### JavaScript interop
For performance reasons, a potentially **BREAKING** change was added for
2021-07-09 01:34:24 +00:00
libraries that use JS interop. Any Dart file that uses `@JS` annotations on
declarations (top-level functions, classes or class members) to interop with
JavaScript code will require that the file have the annotation `@JS()` on a
library directive.
2016-04-25 21:43:43 +00:00
```dart
@JS ()
library my_library;
```
The analyzer will enforce this by generating the error:
The `@JS()` annotation can only be used if it is also declared on the library
directive.
If part file uses the `@JS()` annotation, the library that uses the part should
have the `@JS()` annotation e.g.,
```dart
// library_1.dart
@JS ()
library library_1;
import 'package:js/js.dart';
part 'part_1.dart';
```
```dart
// part_1.dart
part of library_1;
@JS ("frameworkStabilizers")
external List< FrameworkStabilizer > get frameworkStabilizers;
```
If your library already has a JS module e.g.,
```dart
@JS ('array.utils')
library my_library;
```
Then your library will work without any additional changes.
2016-03-09 00:13:03 +00:00
### Analyzer
2021-07-09 01:34:24 +00:00
- Static checking of `for in` statements. These will now produce static
warnings:
2016-03-09 00:13:03 +00:00
2021-07-09 01:34:24 +00:00
```dart
// Not Iterable.
for (var i in 1234) { ... }
2016-03-09 00:13:03 +00:00
2021-07-09 01:34:24 +00:00
// String cannot be assigned to int.
for (int n in < String > ["a", "b"]) { ... }
```
2016-03-09 00:13:03 +00:00
2016-03-21 19:43:25 +00:00
### Tool Changes
2021-07-09 01:34:24 +00:00
- Pub
- `pub serve` now provides caching headers that should improve the performance
2016-03-21 19:43:25 +00:00
of requesting large files multiple times.
2021-07-09 01:34:24 +00:00
- Both `pub get` and `pub upgrade` now have a `--no-precompile` flag that
2016-03-21 19:43:25 +00:00
disables precompilation of executables and transformed dependencies.
2021-07-09 01:34:24 +00:00
- `pub publish` now resolves symlinks when publishing from a Git repository.
2016-04-13 23:25:08 +00:00
This matches the behavior it always had when publishing a package that
wasn't in a Git repository.
2021-07-09 01:34:24 +00:00
- Dart Dev Compiler
- The **experimental** `dartdevc` executable has been added to the SDK.
2016-03-31 23:55:51 +00:00
2021-07-09 01:34:24 +00:00
- It will help early adopters validate the implementation and provide
2016-04-01 21:19:57 +00:00
feedback. `dartdevc` **is not** yet ready for production usage.
2016-03-31 23:55:51 +00:00
2021-07-09 01:34:24 +00:00
- Read more about the Dart Dev Compiler [here][dartdevc].
2016-03-31 23:55:51 +00:00
[dartdevc]: https://github.com/dart-lang/dev_compiler
2016-03-09 18:14:31 +00:00
## 1.15.0 - 2016-03-09
2016-03-09 17:46:57 +00:00
2016-01-21 11:58:24 +00:00
### Core library changes
2016-02-29 21:19:06 +00:00
2021-07-09 01:34:24 +00:00
- `dart:async`
- Made `StreamView` class a `const` class.
- `dart:core`
2016-02-29 21:19:06 +00:00
2021-07-09 01:34:24 +00:00
- Added `Uri.queryParametersAll` to handle multiple query parameters with the
same name.
2016-01-21 11:58:24 +00:00
2021-07-09 01:34:24 +00:00
- `dart:io`
- Added `SecurityContext.usePrivateKeyBytes` ,
2016-02-29 21:19:06 +00:00
`SecurityContext.useCertificateChainBytes` ,
`SecurityContext.setTrustedCertificatesBytes` , and
`SecurityContext.setClientAuthoritiesBytes` .
2021-07-09 01:34:24 +00:00
- **Breaking** The named `directory` argument of
2016-03-01 18:34:15 +00:00
`SecurityContext.setTrustedCertificates` has been removed.
2021-07-09 01:34:24 +00:00
- Added support to `SecurityContext` for PKCS12 certificate and key
2016-02-29 21:19:06 +00:00
containers.
2021-07-09 01:34:24 +00:00
- All calls in `SecurityContext` that accept certificate data now accept an
2016-02-17 18:58:19 +00:00
optional named parameter `password` , similar to
`SecurityContext.usePrivateKeyBytes` , for use as the password for PKCS12
data.
2016-02-08 16:41:49 +00:00
2016-03-09 23:19:30 +00:00
### Tool changes
2016-03-04 03:52:53 +00:00
2021-07-09 01:34:24 +00:00
- Dartium and content shell
- The Chrome-based tools that ship as part of the Dart SDK - Dartium and
2020-04-21 14:28:53 +00:00
content shell - are now based on Chrome version 45 (instead of Chrome 39).
2021-07-09 01:34:24 +00:00
- Dart browser libraries (`dart:html`, `dart:svg` , etc) _have not_ been
2016-03-09 23:19:30 +00:00
updated.
2021-07-09 01:34:24 +00:00
- These are still based on Chrome 39.
- These APIs will be updated in a future release.
- Note that there are experimental APIs which have changed in the underlying
browser, and will not work with the older libraries. For example,
`Element.animate` .
- `dartfmt` - upgraded to v0.2.4
- Better handling for long collections with comments.
- Always put member metadata annotations on their own line.
- Indent functions in named argument lists with non-functions.
- Force the parameter list to split if a split occurs inside a function-typed
2016-03-09 23:19:30 +00:00
parameter.
2021-07-09 01:34:24 +00:00
- Don't force a split for before a single named argument if the argument
2016-03-09 23:19:30 +00:00
itself splits.
2016-03-03 15:12:13 +00:00
### Service protocol changes
2021-07-09 01:34:24 +00:00
- Fixed a documentation bug where the field `extensionRPCs` in `Isolate` was not
marked optional.
2016-03-03 15:12:13 +00:00
2016-03-03 18:53:37 +00:00
### Experimental language features
2021-07-09 01:34:24 +00:00
- Added support for
[configuration-specific imports ](https://github.com/munificent/dep-interface-libraries/blob/master/Proposal.md ).
On the VM and `dart2js` , they can be enabled with `--conditional-directives` .
The analyzer requires additional configuration:
2016-03-03 18:53:37 +00:00
2021-07-09 01:34:24 +00:00
```yaml
analyzer:
language:
enableConditionalDirectives: true
```
Read about [configuring the analyzer] for more details.
2016-03-03 18:53:37 +00:00
2021-07-09 01:34:24 +00:00
[configuring the analyzer]:
https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer
2016-03-03 18:53:37 +00:00
2016-03-09 18:14:31 +00:00
## 1.14.2 - 2016-02-10
2016-02-11 21:22:54 +00:00
2016-03-09 18:14:31 +00:00
Patch release, resolves three issues:
2021-07-09 01:34:24 +00:00
- VM: Fixed a code generation bug on x64. (SDK commit
[834b3f02 ](https://github.com/dart-lang/sdk/commit/834b3f02b6ab740a213fd808e6c6f3269bed80e5 ))
2016-03-09 18:14:31 +00:00
2021-07-09 01:34:24 +00:00
- `dart:io` : Fixed EOF detection when reading some special device files. (SDK
issue [25596 ](https://github.com/dart-lang/sdk/issues/25596 ))
2016-03-09 18:14:31 +00:00
2021-07-09 01:34:24 +00:00
- Pub: Fixed an error using hosted dependencies in SDK version 1.14. (Pub issue
[1386 ](https://github.com/dart-lang/pub/issues/1386 ))
2016-02-11 21:22:54 +00:00
2016-02-04 14:24:35 +00:00
## 1.14.1 - 2016-02-04
Patch release, resolves one issue:
2021-07-09 01:34:24 +00:00
- Debugger: Fixes a VM crash when a debugger attempts to set a break point
during isolate initialization. (SDK issue
[25618 ](https://github.com/dart-lang/sdk/issues/25618 ))
2016-02-04 14:24:35 +00:00
2016-01-31 22:38:17 +00:00
## 1.14.0 - 2016-01-28
2015-10-19 20:03:05 +00:00
### Core library changes
2021-07-09 01:34:24 +00:00
- `dart:async`
- Added `Future.any` static method.
- Added `Stream.fromFutures` constructor.
- `dart:convert`
- `Base64Decoder.convert` now takes optional `start` and `end` parameters.
- `dart:core`
- Added `current` getter to `StackTrace` class.
- `Uri` class added support for data URIs
- Added two new constructors: `dataFromBytes` and `dataFromString` .
- Added a `data` getter for `data:` URIs with a new `UriData` class for the
return type.
- Added `growable` parameter to `List.filled` constructor.
- Added microsecond support to `DateTime` : `DateTime.microsecond` ,
2015-12-08 23:58:57 +00:00
`DateTime.microsecondsSinceEpoch` , and
`new DateTime.fromMicrosecondsSinceEpoch` .
2015-11-12 12:02:20 +00:00
2021-07-09 01:34:24 +00:00
- `dart:math`
- `Random` added a `secure` constructor returning a cryptographically secure
2015-11-18 12:34:19 +00:00
random generator which reads from the entropy source provided by the
embedder for every generated random value.
2015-11-12 12:02:20 +00:00
2021-07-09 01:34:24 +00:00
- `dart:io`
- `Platform` added a static `isIOS` getter and `Platform.operatingSystem` may
2016-01-27 17:43:24 +00:00
now return `ios` .
2021-07-09 01:34:24 +00:00
- `Platform` added a static `packageConfig` getter.
- Added support for WebSocket compression as standardized in RFC 7692.
- Compression is enabled by default for all WebSocket connections.
- The optionally named parameter `compression` on the methods
2016-01-27 17:43:24 +00:00
`WebSocket.connect` , `WebSocket.fromUpgradedSocket` , and
2021-07-09 01:34:24 +00:00
`WebSocketTransformer.upgrade` and the `WebSocketTransformer` constructor
can be used to modify or disable compression using the new
2016-01-27 17:43:24 +00:00
`CompressionOptions` class.
2021-07-09 01:34:24 +00:00
- `dart:isolate`
- Added **_experimental_** support for [Package Resolution Configuration].
- Added `packageConfig` and `packageRoot` instance getters to `Isolate` .
- Added a `resolvePackageUri` method to `Isolate` .
- Added named arguments `packageConfig` and `automaticPackageResolution` to
the `Isolate.spawnUri` constructor.
2016-01-27 17:43:24 +00:00
2021-07-09 01:34:24 +00:00
[package resolution configuration]:
https://github.com/dart-lang/dart_enhancement_proposals/blob/master/Accepted/0005%20-%20Package%20Specification/DEP-pkgspec.md
2015-11-13 19:15:04 +00:00
2015-12-02 22:06:05 +00:00
### Tool changes
2021-07-09 01:34:24 +00:00
- `dartfmt`
2015-12-10 00:13:57 +00:00
2021-07-09 01:34:24 +00:00
- Better line splitting in a variety of cases.
2015-12-10 00:13:57 +00:00
2021-07-09 01:34:24 +00:00
- Other optimizations and bug fixes.
2015-12-10 00:13:57 +00:00
2021-07-09 01:34:24 +00:00
- Pub
2015-12-02 22:06:05 +00:00
2021-07-09 01:34:24 +00:00
- **Breaking:** Pub now eagerly emits an error when a pubspec's "name" field
2015-12-02 22:06:05 +00:00
is not a valid Dart identifier. Since packages with non-identifier names
were never allowed to be published, and some of them already caused crashes
when being written to a `.packages` file, this is unlikely to break many
people in practice.
2021-07-09 01:34:24 +00:00
- **Breaking:** Support for `barback` versions prior to 0.15.0 (released July
1. has been dropped. Pub will no longer install these older barback
versions.
2015-12-18 00:44:37 +00:00
2021-07-09 01:34:24 +00:00
- `pub serve` now GZIPs the assets it serves to make load times more similar
2015-12-02 22:06:05 +00:00
to real-world use-cases.
2021-07-09 01:34:24 +00:00
- `pub deps` now supports a `--no-dev` flag, which causes it to emit the
2015-12-02 22:06:05 +00:00
dependency tree as it would be if no `dev_dependencies` were in use. This
makes it easier to see your package's dependency footprint as your users
will experience it.
2021-07-09 01:34:24 +00:00
- `pub global run` now detects when a global executable's SDK constraint is no
2015-12-02 22:06:05 +00:00
longer met and errors out, rather than trying to run the executable anyway.
2021-07-09 01:34:24 +00:00
- Pub commands that check whether the lockfile is up-to-date (`pub run`,
`pub deps` , `pub serve` , and `pub build` ) now do additional verification.
They ensure that any path dependencies' pubspecs haven't been changed, and
they ensure that the current SDK version is compatible with all
dependencies.
2016-01-11 20:43:51 +00:00
2021-07-09 01:34:24 +00:00
- Fixed a crashing bug when using `pub global run` on a global script that
2015-12-02 22:06:05 +00:00
didn't exist.
2021-07-09 01:34:24 +00:00
- Fixed a crashing bug when a pubspec contains a dependency without a source
2015-12-02 22:06:05 +00:00
declared.
2016-01-12 10:09:23 +00:00
## 1.13.2 - 2016-01-06
2016-01-12 10:16:03 +00:00
Patch release, resolves one issue:
2016-01-12 10:09:23 +00:00
2021-07-09 01:34:24 +00:00
- dart2js: Stack traces are not captured correctly (SDK issue [25235]
(https://github.com/dart-lang/sdk/issues/25235))
2016-01-12 10:09:23 +00:00
## 1.13.1 - 2015-12-17
Patch release, resolves three issues:
2021-07-09 01:34:24 +00:00
- VM type propagation fix: Resolves a potential crash in the Dart VM (SDK commit
[dff13be]
(https://github.com/dart-lang/sdk/commit/dff13bef8de104d33b04820136da2d80f3c835d7))
2016-01-12 10:09:23 +00:00
2021-07-09 01:34:24 +00:00
- dart2js crash fix: Resolves a crash in pkg/js and dart2js (SDK issue [24974]
(https://github.com/dart-lang/sdk/issues/24974))
2016-01-12 10:09:23 +00:00
2021-07-09 01:34:24 +00:00
- Pub get crash on ARM: Fixes a crash triggered when running 'pub get' on ARM
processors such as those on a Raspberry Pi (SDK issue [24855]
(https://github.com/dart-lang/sdk/issues/24855))
2016-01-12 10:09:23 +00:00
2015-11-19 00:45:21 +00:00
## 1.13.0 - 2015-11-18
2015-08-10 10:18:12 +00:00
2015-10-01 17:36:07 +00:00
### Core library changes
2021-07-09 01:34:24 +00:00
- `dart:async`
- `StreamController` added getters for `onListen` , `onPause` , and `onResume`
2015-10-29 21:57:10 +00:00
with the corresponding new `typedef void ControllerCallback()` .
2021-07-09 01:34:24 +00:00
- `StreamController` added a getter for `onCancel` with the corresponding new
`typedef ControllerCancelCallback()` ;
- `StreamTransformer` instances created with `fromHandlers` with no
2015-10-01 16:58:49 +00:00
`handleError` callback now forward stack traces along with errors to the
resulting streams.
2021-07-09 01:34:24 +00:00
- `dart:convert`
- Added support for Base-64 encoding and decoding.
- Added new classes `Base64Codec` , `Base64Encoder` , and `Base64Decoder` .
- Added new top-level `const Base64Codec BASE64` .
- `dart:core`
- `Uri` added `removeFragment` method.
- `String.allMatches` (implementing `Pattern.allMatches` ) is now lazy, as all
`allMatches` implementations are intended to be.
- `Resource` is deprecated, and will be removed in a future release.
- `dart:developer`
- Added `Timeline` class for interacting with Observatory's timeline feature.
- Added `ServiceExtensionHandler` , `ServiceExtensionResponse` , and
`registerExtension` which enable developers to provide their own VM service
protocol extensions.
- `dart:html` , `dart:indexed_db` , `dart:svg` , `dart:web_audio` , `dart:web_gl` ,
`dart:web_sql`
- The return type of some APIs changed from `double` to `num` . Dartium is now
using JS interop for most operations. JS does not distinguish between
numeric types, and will return a number as an int if it fits in an int. This
will mostly cause an error if you assign to something typed `double` in
checked mode. You may need to insert a `toDouble()` call or accept `num` .
Examples of APIs that are affected include `Element.getBoundingClientRect`
and `TextMetrics.width` .
- `dart:io`
- **Breaking:** Secure networking has changed, replacing the NSS library with
the BoringSSL library. `SecureSocket` , `SecureServerSocket` ,
2015-11-03 12:32:10 +00:00
`RawSecureSocket` ,`RawSecureServerSocket`, `HttpClient` , and `HttpServer`
2021-07-09 01:34:24 +00:00
now all use a `SecurityContext` object which contains the certificates and
keys used for secure TLS (SSL) networking.
2015-11-03 12:32:10 +00:00
This is a breaking change for server applications and for some client
applications. Certificates and keys are loaded into the `SecurityContext`
from PEM files, instead of from an NSS certificate database. Information
about how to change applications that use secure networking is at
https://www.dartlang.org/server/tls-ssl.html
2021-07-09 01:34:24 +00:00
- `HttpClient` no longer sends URI fragments in the request. This is not
allowed by the HTTP protocol. The `HttpServer` still gracefully receives
fragments, but discards them before delivering the request.
- To allow connections to be accepted on the same port across different
2015-10-29 22:01:59 +00:00
isolates, set the `shared` argument to `true` when creating server socket
and `HttpServer` instances.
2021-07-09 01:34:24 +00:00
- The deprecated `ServerSocketReference` and `RawServerSocketReference`
2015-10-29 22:01:59 +00:00
classes have been removed.
2021-07-09 01:34:24 +00:00
- The corresponding `reference` properties on `ServerSocket` and
2015-10-29 22:01:59 +00:00
`RawServerSocket` have been removed.
2015-08-10 10:18:12 +00:00
2021-07-09 01:34:24 +00:00
- `dart:isolate`
- `spawnUri` added an `environment` named argument.
2015-10-12 14:31:48 +00:00
2015-09-23 17:27:15 +00:00
### Tool changes
2023-01-26 09:12:41 +00:00
- `dart2js` and Dartium now support improved JavaScript Interoperability via the
2022-02-08 19:29:56 +00:00
[js package ](https://pub.dev/packages/js ).
2015-11-11 20:19:43 +00:00
2021-07-09 01:34:24 +00:00
- `docgen` and `dartdocgen` no longer ship in the SDK. The `docgen` sources have
been removed from the repository.
2015-09-23 17:27:15 +00:00
2021-07-09 01:34:24 +00:00
- This is the last release to ship the VM's "legacy debug protocol". We intend
to remove the legacy debug protocol in Dart VM 1.14.
2015-10-01 17:36:07 +00:00
2021-07-09 01:34:24 +00:00
- The VM's Service Protocol has been updated to version 3.0 to take care of a
number of issues uncovered by the first few non-observatory clients. This is a
potentially breaking change for clients.
2015-10-01 17:46:44 +00:00
2021-07-09 01:34:24 +00:00
- Dartium has been substantially changed. Rather than using C++ calls into
Chromium internals for DOM operations it now uses JS interop. The DOM objects
in `dart:html` and related libraries now wrap a JavaScript object and delegate
operations to it. This should be mostly transparent to users. However,
performance and memory characteristics may be different from previous
versions. There may be some changes in which DOM objects are wrapped as Dart
objects. For example, if you get a reference to a Window object, even through
JS interop, you will always see it as a Dart Window, even when used
cross-frame. We expect the change to using JS interop will make it much
simpler to update to new Chrome versions.
2015-11-12 01:06:25 +00:00
2015-10-23 10:44:32 +00:00
## 1.12.2 - 2015-10-21
### Core library changes
2021-07-09 01:34:24 +00:00
- `dart:io`
2015-10-23 10:44:32 +00:00
2021-07-09 01:34:24 +00:00
- A memory leak in creation of Process objects is fixed.
2015-10-23 10:44:32 +00:00
## 1.12.1 - 2015-09-08
### Tool changes
2021-07-09 01:34:24 +00:00
- Pub
2015-10-23 10:44:32 +00:00
2021-07-09 01:34:24 +00:00
- Pub will now respect `.gitignore` when validating a package before it's
2015-10-23 10:44:32 +00:00
published. For example, if a `LICENSE` file exists but is ignored, that is
now an error.
2021-07-09 01:34:24 +00:00
- If the package is in a subdirectory of a Git repository and the entire
2015-10-23 10:44:32 +00:00
subdirectory is ignored with `.gitignore` , pub will act as though nothing
was ignored instead of uploading an empty package.
2021-07-09 01:34:24 +00:00
- The heuristics for determining when `pub get` needs to be run before various
2015-10-23 10:44:32 +00:00
commands have been improved. There should no longer be false positives when
non-dependency sections of the pubspec have been modified.
## 1.12.0 - 2015-08-31
2015-06-23 20:39:40 +00:00
2015-08-25 09:34:34 +00:00
### Language changes
2021-07-09 01:34:24 +00:00
- Null-aware operators
- `??` : if null operator. `expr1 ?? expr2` evaluates to `expr1` if not `null` ,
otherwise `expr2` .
- `??=` : null-aware assignment. `v ??= expr` causes `v` to be assigned `expr`
only if `v` is `null` .
- `x?.p` : null-aware access. `x?.p` evaluates to `x.p` if `x` is not `null` ,
otherwise evaluates to `null` .
- `x?.m()` : null-aware method invocation. `x?.m()` invokes `m` only if `x` is
not `null` .
2015-08-25 09:34:34 +00:00
2015-06-23 20:39:40 +00:00
### Core library changes
2021-07-09 01:34:24 +00:00
- `dart:async`
- `StreamController` added setters for the `onListen` , `onPause` , `onResume`
2015-07-17 10:03:00 +00:00
and `onCancel` callbacks.
2021-07-09 01:34:24 +00:00
- `dart:convert`
- `LineSplitter` added a `split` static method returning an `Iterable` .
2015-07-15 10:26:24 +00:00
2021-07-09 01:34:24 +00:00
- `dart:core`
- `Uri` class now perform path normalization when a URI is created. This
removes most `..` and `.` sequences from the URI path. Purely relative paths
(no scheme or authority) are allowed to retain some leading "dot" segments.
2015-08-05 10:58:30 +00:00
Also added `hasAbsolutePath` , `hasEmptyPath` , and `hasScheme` properties.
2015-07-17 15:08:36 +00:00
2021-07-09 01:34:24 +00:00
- `dart:developer`
- New `log` function to transmit logging events to Observatory.
- `dart:html`
- `NodeTreeSanitizer` added the `const trusted` field. It can be used instead
of defining a `NullTreeSanitizer` class when calling `setInnerHtml` or other
methods that create DOM from text. It is also more efficient, skipping the
creation of a `DocumentFragment` .
2015-08-18 22:56:42 +00:00
2021-07-09 01:34:24 +00:00
- `dart:io`
2015-06-23 20:39:40 +00:00
2021-07-09 01:34:24 +00:00
- Added two new file modes, `WRITE_ONLY` and `WRITE_ONLY_APPEND` for opening a
file write only.
2015-07-03 12:52:40 +00:00
[eaeecf2 ](https://github.com/dart-lang/sdk/commit/eaeecf2ed13ba6c7fbfd653c3c592974a7120960 )
2021-07-09 01:34:24 +00:00
- Change stdout/stderr to binary mode on Windows.
2015-07-10 14:29:57 +00:00
[4205b29 ](https://github.com/dart-lang/sdk/commit/4205b2997e01f2cea8e2f44c6f46ed6259ab7277 )
2015-07-03 12:52:40 +00:00
2021-07-09 01:34:24 +00:00
- `dart:isolate`
- Added `onError` , `onExit` and `errorsAreFatal` parameters to
2015-08-18 07:44:48 +00:00
`Isolate.spawnUri` .
2021-07-09 01:34:24 +00:00
- `dart:mirrors`
- `InstanceMirror.delegate` moved up to `ObjectMirror` .
- Fix InstanceMirror.getField optimization when the selector is an operator.
- Fix reflective NoSuchMethodErrors to match their non-reflective counterparts
when due to argument mismatches. (VM only)
2015-08-17 22:25:57 +00:00
2015-06-29 23:26:45 +00:00
### Tool changes
2021-07-09 01:34:24 +00:00
- Documentation tools
2015-08-18 22:56:42 +00:00
2021-07-09 01:34:24 +00:00
- `dartdoc` is now the default tool to generate static HTML for API docs.
2022-02-08 19:29:56 +00:00
[Learn more ](https://pub.dev/packages/dartdoc ).
2015-08-18 22:56:42 +00:00
2021-07-09 01:34:24 +00:00
- `docgen` and `dartdocgen` have been deprecated. Currently plan is to remove
2015-08-18 22:56:42 +00:00
them in 1.13.
2021-07-09 01:34:24 +00:00
- Formatter (`dartfmt`)
- Over 50 bugs fixed.
2015-08-18 22:56:42 +00:00
2021-07-09 01:34:24 +00:00
- Optimized line splitter is much faster and produces better output on complex
code.
2015-08-18 22:56:42 +00:00
2021-07-09 01:34:24 +00:00
- Observatory
2015-08-18 22:56:42 +00:00
2021-07-09 01:34:24 +00:00
- Allocation profiling.
2015-08-18 22:56:42 +00:00
2021-07-09 01:34:24 +00:00
- New feature to display output from logging.
2015-08-18 22:56:42 +00:00
2021-07-09 01:34:24 +00:00
- Heap snapshot analysis works for 64-bit VMs.
2015-08-18 22:56:42 +00:00
2021-07-09 01:34:24 +00:00
- Improved ability to inspect typed data, regex and compiled code.
2015-08-18 22:56:42 +00:00
2021-07-09 01:34:24 +00:00
- Ability to break on all or uncaught exceptions from Observatory's debugger.
2015-08-18 22:56:42 +00:00
2021-07-09 01:34:24 +00:00
- Ability to set closure-specific breakpoints.
2015-08-18 22:56:42 +00:00
2021-07-09 01:34:24 +00:00
- 'anext' - step past await/yield.
2015-08-18 22:56:42 +00:00
2021-07-09 01:34:24 +00:00
- Preserve when a variable has been expanded/unexpanded in the debugger.
2015-08-18 22:56:42 +00:00
2021-07-09 01:34:24 +00:00
- Keep focus on debugger input box whenever possible.
2015-08-18 22:56:42 +00:00
2021-07-09 01:34:24 +00:00
- Echo stdout/stderr in the Observatory debugger. Standalone-only so far.
2015-08-18 22:56:42 +00:00
2021-07-09 01:34:24 +00:00
- Minor fixes to service protocol documentation.
2015-08-18 22:56:42 +00:00
2021-07-09 01:34:24 +00:00
- Pub
2015-06-29 23:26:45 +00:00
2021-07-09 01:34:24 +00:00
- **Breaking:** various commands that previously ran `pub get` implicitly no
2015-08-14 22:27:22 +00:00
longer do so. Instead, they merely check to make sure the ".packages" file
is newer than the pubspec and the lock file, and fail if it's not.
2021-07-09 01:34:24 +00:00
- Added support for `--verbosity=error` and `--verbosity=warning` .
2015-08-14 22:27:22 +00:00
2021-07-09 01:34:24 +00:00
- `pub serve` now collapses multiple GET requests into a single line of
2015-08-14 22:27:22 +00:00
output. For full output, use `--verbose` .
2021-07-09 01:34:24 +00:00
- `pub deps` has improved formatting for circular dependencies on the
2015-08-14 22:27:22 +00:00
entrypoint package.
2021-07-09 01:34:24 +00:00
- `pub run` and `pub global run`
2015-07-20 22:29:48 +00:00
2021-07-09 01:34:24 +00:00
- **Breaking:** to match the behavior of the Dart VM, executables no longer
2015-08-14 22:27:22 +00:00
run in checked mode by default. A `--checked` flag has been added to run
them in checked mode manually.
2021-07-09 01:34:24 +00:00
- Faster start time for executables that don't import transformed code.
2015-07-20 22:29:48 +00:00
2021-07-09 01:34:24 +00:00
- Binstubs for globally-activated executables are now written in the system
2015-07-20 22:29:48 +00:00
encoding, rather than always in `UTF-8` . To update existing executables,
run `pub cache repair` .
2015-06-29 23:26:45 +00:00
2021-07-09 01:34:24 +00:00
- `pub get` and `pub upgrade`
2015-07-14 20:19:30 +00:00
2021-07-09 01:34:24 +00:00
- Pub will now generate a ".packages" file in addition to the "packages"
directory when running `pub get` or similar operations, per the [package
spec proposal][]. Pub now has a `--no-package-symlinks` flag that will
stop "packages" directories from being generated at all.
2015-07-14 20:19:30 +00:00
2021-07-09 01:34:24 +00:00
- An issue where HTTP requests were sometimes made even though `--offline`
2015-07-14 20:19:30 +00:00
was passed has been fixed.
2021-07-09 01:34:24 +00:00
- A bug with `--offline` that caused an unhelpful error message has been
2015-07-14 20:19:30 +00:00
fixed.
2021-07-09 01:34:24 +00:00
- Pub will no longer time out when a package takes a long time to download.
2015-07-14 20:19:30 +00:00
2021-07-09 01:34:24 +00:00
- `pub publish`
2015-07-14 20:19:30 +00:00
2021-07-09 01:34:24 +00:00
- Pub will emit a non-zero exit code when it finds a violation while
2015-07-14 20:19:30 +00:00
publishing.
2021-07-09 01:34:24 +00:00
- `.gitignore` files will be respected even if the package isn't at the top
2015-07-14 20:19:30 +00:00
level of the Git repository.
2021-07-09 01:34:24 +00:00
- Barback integration
2015-07-09 20:20:03 +00:00
2021-07-09 01:34:24 +00:00
- A crashing bug involving transformers that only apply to non-public code
2015-07-14 20:19:30 +00:00
has been fixed.
2015-07-09 20:20:03 +00:00
2021-07-09 01:34:24 +00:00
- A deadlock caused by declaring transformer followed by a lazy transformer
2015-07-27 23:16:56 +00:00
(such as the built-in `$dart2js` transformer) has been fixed.
2021-07-09 01:34:24 +00:00
- A stack overflow caused by a transformer being run multiple times on the
2015-07-14 20:19:30 +00:00
package that defines it has been fixed.
2015-07-09 20:20:03 +00:00
2023-01-25 14:08:27 +00:00
- A transformer that tries to read a nonexistent asset in another package
2015-07-20 22:29:48 +00:00
will now be re-run if that asset is later created.
2015-06-29 23:26:45 +00:00
[package spec proposal]: https://github.com/lrhn/dep-pkgspec
2015-07-27 18:10:16 +00:00
### VM Service Protocol Changes
2021-07-09 01:34:24 +00:00
- **BREAKING** The service protocol now sends JSON-RPC 2.0-compatible
server-to-client events. To reflect this, the service protocol version is now
2.0.
2015-07-29 00:17:40 +00:00
2021-07-09 01:34:24 +00:00
- The service protocol now includes a `"jsonrpc"` property in its responses, as
2015-07-27 23:14:34 +00:00
opposed to `"json-rpc"` .
2021-07-09 01:34:24 +00:00
- The service protocol now properly handles requests with non-string ids.
2015-07-27 23:14:34 +00:00
Numeric ids are no longer converted to strings, and null ids now don't produce
a response.
2021-07-09 01:34:24 +00:00
- Some RPCs that didn't include a `"jsonrpc"` property in their responses now
2015-07-27 18:10:16 +00:00
include one.
2015-10-23 10:44:32 +00:00
## 1.11.2 - 2015-08-03
2015-07-15 20:30:06 +00:00
### Core library changes
2021-07-09 01:34:24 +00:00
- Fix a bug where `WebSocket.close()` would crash if called after
2015-07-15 20:30:06 +00:00
`WebSocket.cancel()` .
2015-10-23 10:44:32 +00:00
## 1.11.1 - 2015-07-02
2015-06-29 23:26:45 +00:00
### Tool changes
2021-07-09 01:34:24 +00:00
- Pub will always load Dart SDK assets from the SDK whose `pub` executable was
2015-06-29 23:26:45 +00:00
run, even if a `DART_SDK` environment variable is set.
2015-06-25 16:04:11 +00:00
## 1.11.0 - 2015-06-25
2015-06-23 20:39:40 +00:00
### Core library changes
2021-07-09 01:34:24 +00:00
- `dart:core`
- `Iterable` added an `empty` constructor.
2015-06-23 20:39:40 +00:00
[dcf0286 ](https://github.com/dart-lang/sdk/commit/dcf0286f5385187a68ce9e66318d3bf19abf454b )
2021-07-09 01:34:24 +00:00
- `Iterable` can now be extended directly. An alternative to extending
2015-07-14 13:37:06 +00:00
`IterableBase` from `dart:collection` .
2021-07-09 01:34:24 +00:00
- `List` added an `unmodifiable` constructor.
2015-04-29 18:11:59 +00:00
[r45334 ](https://code.google.com/p/dart/source/detail?r=45334 )
2021-07-09 01:34:24 +00:00
- `Map` added an `unmodifiable` constructor.
2015-05-26 12:21:20 +00:00
[r45733 ](https://code.google.com/p/dart/source/detail?r=45733 )
2021-07-09 01:34:24 +00:00
- `int` added a `gcd` method.
2015-06-23 21:44:48 +00:00
[a192ef4 ](https://github.com/dart-lang/sdk/commit/a192ef4acb95fad1aad1887f59eed071eb5e8201 )
2021-07-09 01:34:24 +00:00
- `int` added a `modInverse` method.
2015-06-23 21:17:32 +00:00
[f6f338c ](https://github.com/dart-lang/sdk/commit/f6f338ce67eb8801b350417baacf6d3681b26002 )
2021-07-09 01:34:24 +00:00
- `StackTrace` added a `fromString` constructor.
2015-06-23 21:17:32 +00:00
[68dd6f6 ](https://github.com/dart-lang/sdk/commit/68dd6f6338e63d0465041d662e778369c02c2ce6 )
2021-07-09 01:34:24 +00:00
- `Uri` added a `directory` constructor.
2015-06-23 21:17:32 +00:00
[d8dbb4a ](https://github.com/dart-lang/sdk/commit/d8dbb4a60f5e8a7f874c2a4fbf59eaf1a39f4776 )
2021-07-09 01:34:24 +00:00
- List iterators may not throw `ConcurrentModificationError` as eagerly in
release mode. In checked mode, the modification check is still as eager as
possible. [r45198 ](https://github.com/dart-lang/sdk/commit/5a79c03 )
- `dart:developer` - **NEW**
- Replaces the deprecated `dart:profiler` library.
- Adds new functions `debugger` and `inspect` .
2015-06-23 21:35:59 +00:00
[6e42aec ](https://github.com/dart-lang/sdk/blob/6e42aec4f64cf356dde7bad9426e07e0ea5b58d5/sdk/lib/developer/developer.dart )
2021-07-09 01:34:24 +00:00
- `dart:io`
- `FileSystemEntity` added a `uri` property.
2015-06-23 20:39:40 +00:00
[8cf32dc ](https://github.com/dart-lang/sdk/commit/8cf32dc1a1664b516e57f804524e46e55fae88b2 )
2021-07-09 01:34:24 +00:00
- `Platform` added a `static resolvedExecutable` property.
2015-06-23 20:39:40 +00:00
[c05c8c6 ](https://github.com/dart-lang/sdk/commit/c05c8c66069db91cc2fd48691dfc406c818d411d )
2015-06-23 21:35:59 +00:00
2021-07-09 01:34:24 +00:00
- `dart:html`
- `Element` methods, `appendHtml` and `insertAdjacentHtml` now take
`nodeValidator` and `treeSanitizer` parameters, and the inputs are
consistently sanitized.
2015-06-23 20:39:40 +00:00
[r45818 announcement ](https://groups.google.com/a/dartlang.org/forum/#!topic/announce/GVO7EAcPi6A )
2015-06-23 21:35:59 +00:00
2021-07-09 01:34:24 +00:00
- `dart:isolate`
2015-04-16 09:02:52 +00:00
2021-07-09 01:34:24 +00:00
- **BREAKING** The positional `priority` parameter of `Isolate.ping` and
`Isolate.kill` is now a named parameter named `priority` .
- **BREAKING** Removed the `Isolate.AS_EVENT` priority.
- `Isolate` methods `ping` and `addOnExitListener` now have a named parameter
`response` . [r45092 ](https://github.com/dart-lang/sdk/commit/1b208bd )
- `Isolate.spawnUri` added a named argument `checked` .
- Remove the experimental state of the API.
- `dart:profiler` - **DEPRECATED**
- This library will be removed in 1.12. Use `dart:developer` instead.
2015-06-23 21:35:59 +00:00
2015-05-19 15:38:01 +00:00
### Tool changes
2021-07-09 01:34:24 +00:00
- This is the first release that does not include the Eclipse-based **Dart
2022-02-08 19:29:56 +00:00
Editor**. See [dart.dev/tools ](https://dart.dev/tools#ides-and-editors ) for
2021-07-09 01:34:24 +00:00
alternatives.
- This is the last release that ships the (unsupported) dart2dart (aka
`dart2js --output-type=dart` ) utility as part of dart2js
2015-05-19 15:38:01 +00:00
2020-04-21 14:28:53 +00:00
## 1.10.0 - 2015-04-29
2015-04-16 09:02:52 +00:00
### Core library changes
2021-07-09 01:34:24 +00:00
- `dart:convert`
- **POTENTIALLY BREAKING** Fix behavior of `HtmlEscape` . It no longer escapes
no-break space (U+00A0) anywhere or forward slash (`/`, `U+002F` ) in element
context. Slash is still escaped using `HtmlEscapeMode.UNKNOWN` .
[r45003 ](https://github.com/dart-lang/sdk/commit/8b8223d ),
[r45153 ](https://github.com/dart-lang/sdk/commit/8a5d049 ),
[r45189 ](https://github.com/dart-lang/sdk/commit/3c39ad2 )
- `dart:core`
- `Uri.parse` added `start` and `end` positional arguments.
2015-04-16 09:02:52 +00:00
2021-07-09 01:34:24 +00:00
- `dart:html`
2015-04-29 18:11:59 +00:00
2021-07-09 01:34:24 +00:00
- **POTENTIALLY BREAKING** `CssClassSet` method arguments must now be
'tokens', i.e. non-empty strings with no white-space characters. The
implementation was incorrect for class names containing spaces. The fix is
to forbid spaces and provide a faster implementation.
[Announcement ](https://groups.google.com/a/dartlang.org/d/msg/announce/jmUI2XJHfC8/UZUCvJH3p2oJ )
2015-04-30 21:50:46 +00:00
2021-07-09 01:34:24 +00:00
- `dart:io`
2015-04-30 21:50:46 +00:00
2021-07-09 01:34:24 +00:00
- `ProcessResult` now exposes a constructor.
- `import` and `Isolate.spawnUri` now supports the
2015-04-30 21:50:46 +00:00
[Data URI scheme ](http://en.wikipedia.org/wiki/Data_URI_scheme ) on the VM.
2022-09-07 09:46:57 +00:00
### Tool Changes
2015-04-30 21:50:46 +00:00
2022-09-07 09:46:57 +00:00
#### pub
2015-04-30 21:50:46 +00:00
2021-07-09 01:34:24 +00:00
- Running `pub run foo` within a package now runs the `foo` executable defined
by the `foo` package. The previous behavior ran `bin/foo` . This makes it easy
to run binaries in dependencies, for instance `pub run test` .
2015-04-30 21:50:46 +00:00
2021-07-09 01:34:24 +00:00
- On Mac and Linux, signals sent to `pub run` and forwarded to the child
command.
2015-04-21 05:09:53 +00:00
2020-04-21 14:28:53 +00:00
## 1.9.3 - 2015-04-14
2015-04-10 19:24:32 +00:00
This is a bug fix release which merges a number of commits from `bleeding_edge` .
2023-01-26 09:12:41 +00:00
- dart2js: Addresses as issue with minified JavaScript output with CSP enabled -
2015-04-10 19:24:32 +00:00
[r44453 ](https://code.google.com/p/dart/source/detail?r=44453 )
2021-07-09 01:34:24 +00:00
- Editor: Fixes accidental updating of files in the pub cache during rename
2015-04-10 19:24:32 +00:00
refactoring - [r44677 ](https://code.google.com/p/dart/source/detail?r=44677 )
2021-07-09 01:34:24 +00:00
- Editor: Fix for
[issue 23032 ](https://code.google.com/p/dart/issues/detail?id=23032 ) regarding
skipped breakpoints on Windows -
2015-04-10 19:24:32 +00:00
[r44824 ](https://code.google.com/p/dart/source/detail?r=44824 )
2021-07-09 01:34:24 +00:00
- dart:mirrors: Fix `MethodMirror.source` when the method is on the first line
in a script - [r44957 ](https://code.google.com/p/dart/source/detail?r=44957 ),
2015-04-10 19:24:32 +00:00
[r44976 ](https://code.google.com/p/dart/source/detail?r=44976 )
2021-07-09 01:34:24 +00:00
- pub: Fix for
[issue 23084 ](https://code.google.com/p/dart/issues/detail?id=23084 ): Pub can
fail to load transformers necessary for local development -
2015-04-10 19:24:32 +00:00
[r44876 ](https://code.google.com/p/dart/source/detail?r=44876 )
2020-04-21 14:28:53 +00:00
## 1.9.1 - 2015-03-25
2015-04-03 23:31:36 +00:00
### Language changes
2021-07-09 01:34:24 +00:00
- Support for `async` , `await` , `sync*` , `async*` , `yield` , `yield*` , and
`await for` . See the [the language tour][async] for more details.
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- Enum support is fully enabled. See [the language tour][enum] for more details.
2015-04-03 23:31:36 +00:00
2022-02-08 19:29:56 +00:00
[async]: https://dart.dev/guides/language/language-tour#asynchrony
[enum]: https://dart.dev/guides/language/language-tour#enums
2015-04-03 23:31:36 +00:00
### Tool changes
2021-07-09 01:34:24 +00:00
- The formatter is much more comprehensive and generates much more readable
2015-04-03 23:31:36 +00:00
code. See [its tool page][dartfmt] for more details.
2021-07-09 01:34:24 +00:00
- The analysis server is integrated into the IntelliJ plugin and the Dart
2015-04-03 23:31:36 +00:00
editor. This allows analysis to run out-of-process, so that interaction
remains smooth even for large projects.
2021-07-09 01:34:24 +00:00
- Analysis supports more and better hints, including unused variables and unused
2015-04-03 23:31:36 +00:00
private members.
2022-02-08 19:29:56 +00:00
[dartfmt]: https://dart.dev/tools/dart-format
2015-04-03 23:31:36 +00:00
### Core library changes
#### Highlights
2021-07-09 01:34:24 +00:00
- There's a new model for shared server sockets with no need for a `Socket`
2015-04-03 23:31:36 +00:00
reference.
2021-07-09 01:34:24 +00:00
- A new, much faster [regular expression engine][regexp].
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- The Isolate API now works across the VM and `dart2js` .
2015-04-03 23:31:36 +00:00
[regexp]: http://news.dartlang.org/2015/02/irregexp-dart-vms-new-regexp.html
#### Details
For more information on any of these changes, see the corresponding
2022-02-08 19:29:56 +00:00
documentation on the [Dart API site ](http://api.dart.dev ).
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- `dart:async` :
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- `Future.wait` added a new named argument, `cleanUp` , which is a callback
2015-04-03 23:31:36 +00:00
that releases resources allocated by a successful `Future` .
2021-07-09 01:34:24 +00:00
- The `SynchronousStreamController` class was added as an explicit name for
the type returned when the `sync` argument is passed to
`new StreamController` .
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- `dart:collection` : The `new SplayTreeSet.from(Iterable)` constructor was
2015-04-03 23:31:36 +00:00
added.
2021-07-09 01:34:24 +00:00
- `dart:convert` : `Utf8Encoder.convert` and `Utf8Decoder.convert` added optional
2015-04-03 23:31:36 +00:00
`start` and `end` arguments.
2021-07-09 01:34:24 +00:00
- `dart:core` :
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- `RangeError` added new static helper functions: `checkNotNegative` ,
2015-04-03 23:31:36 +00:00
`checkValidIndex` , `checkValidRange` , and `checkValueInInterval` .
2021-07-09 01:34:24 +00:00
- `int` added the `modPow` function.
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- `String` added the `replaceFirstMapped` and `replaceRange` functions.
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- `dart:io` :
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- Support for locking files to prevent concurrent modification was added. This
2015-04-03 23:31:36 +00:00
includes the `File.lock` , `File.lockSync` , `File.unlock` , and
`File.unlockSync` functions as well as the `FileLock` class.
2021-07-09 01:34:24 +00:00
- Support for starting detached processes by passing the named `mode` argument
2015-04-03 23:31:36 +00:00
(a `ProcessStartMode` ) to `Process.start` . A process can be fully attached,
fully detached, or detached except for its standard IO streams.
2021-07-09 01:34:24 +00:00
- `HttpServer.bind` and `HttpServer.bindSecure` added the `v6Only` named
2015-04-03 23:31:36 +00:00
argument. If this is true, only IPv6 connections will be accepted.
2015-04-15 19:47:54 +00:00
2021-07-09 01:34:24 +00:00
- `HttpServer.bind` , `HttpServer.bindSecure` , `ServerSocket.bind` ,
2015-04-03 23:31:36 +00:00
`RawServerSocket.bind` , `SecureServerSocket.bind` and
`RawSecureServerSocket.bind` added the `shared` named argument. If this is
true, multiple servers or sockets in the same Dart process may bind to the
same address, and incoming requests will automatically be distributed
between them.
2021-07-09 01:34:24 +00:00
- **Deprecation:** the experimental `ServerSocketReference` and
2015-04-03 23:31:36 +00:00
`RawServerSocketReference` classes, as well as getters that returned them,
are marked as deprecated. The `shared` named argument should be used
instead. These will be removed in Dart 1.10.
2021-07-09 01:34:24 +00:00
- `Socket.connect` and `RawSocket.connect` added the `sourceAddress` named
2015-04-03 23:31:36 +00:00
argument, which specifies the local address to bind when making a
connection.
2021-07-09 01:34:24 +00:00
- The static `Process.killPid` method was added to kill a process with a given
2015-04-03 23:31:36 +00:00
PID.
2021-07-09 01:34:24 +00:00
- `Stdout` added the `nonBlocking` instance property, which returns a
2015-04-03 23:31:36 +00:00
non-blocking `IOSink` that writes to standard output.
2021-07-09 01:34:24 +00:00
- `dart:isolate` :
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- The static getter `Isolate.current` was added.
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- The `Isolate` methods `addOnExitListener` , `removeOnExitListener` ,
2015-04-03 23:31:36 +00:00
`setErrorsFatal` , `addOnErrorListener` , and `removeOnErrorListener` now work
on the VM.
2021-07-09 01:34:24 +00:00
- Isolates spawned via `Isolate.spawn` now allow most objects, including
2015-04-03 23:31:36 +00:00
top-level and static functions, to be sent between them.
2020-04-21 14:28:53 +00:00
## 1.8.5 - 2015-01-21
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- Code generation for SIMD on ARM and ARM64 is fixed.
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- A possible crash on MIPS with newer GCC toolchains has been prevented.
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- A segfault when using `rethrow` was fixed ([issue 21795][]).
2015-04-03 23:31:36 +00:00
[issue 21795]: https://code.google.com/p/dart/issues/detail?id=21795
2020-04-21 14:28:53 +00:00
## 1.8.3 - 2014-12-10
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- Breakpoints can be set in the Editor using file suffixes ([issue 21280][]).
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- IPv6 addresses are properly handled by `HttpClient` in `dart:io` , fixing a
2015-04-03 23:31:36 +00:00
crash in pub ([issue 21698][]).
2021-07-09 01:34:24 +00:00
- Issues with the experimental `async` /`await` syntax have been fixed.
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- Issues with a set of number operations in the VM have been fixed.
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- `ListBase` in `dart:collection` always returns an `Iterable` with the correct
2015-04-03 23:31:36 +00:00
type argument.
[issue 21280]: https://code.google.com/p/dart/issues/detail?id=21280
[issue 21698]: https://code.google.com/p/dart/issues/detail?id=21698
2020-04-21 14:28:53 +00:00
## 1.8.0 - 2014-11-28
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- `dart:collection` : `SplayTree` added the `toSet` function.
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- `dart:convert` : The `JsonUtf8Encoder` class was added.
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- `dart:core` :
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- The `IndexError` class was added for errors caused by an index being outside
2015-04-03 23:31:36 +00:00
its expected range.
2021-07-09 01:34:24 +00:00
- The `new RangeError.index` constructor was added. It forwards to
`new IndexError` .
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- `RangeError` added three new properties. `invalidProperty` is the value that
2015-04-03 23:31:36 +00:00
caused the error, and `start` and `end` are the minimum and maximum values
that the value is allowed to assume.
2021-07-09 01:34:24 +00:00
- `new RangeError.value` and `new RangeError.range` added an optional
2015-04-03 23:31:36 +00:00
`message` argument.
2021-07-09 01:34:24 +00:00
- The `new String.fromCharCodes` constructor added optional `start` and `end`
2015-04-03 23:31:36 +00:00
arguments.
2021-07-09 01:34:24 +00:00
- `dart:io` :
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- Support was added for the [Application-Layer Protocol Negotiation][alpn]
2015-04-03 23:31:36 +00:00
extension to the TLS protocol for both the client and server.
2021-07-09 01:34:24 +00:00
- `SecureSocket.connect` , `SecureServerSocket.bind` ,
2015-04-03 23:31:36 +00:00
`RawSecureSocket.connect` , `RawSecureSocket.secure` ,
`RawSecureSocket.secureServer` , and `RawSecureServerSocket.bind` added a
`supportedProtocols` named argument for protocol negotiation.
2021-07-09 01:34:24 +00:00
- `RawSecureServerSocket` added a `supportedProtocols` field.
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- `RawSecureSocket` and `SecureSocket` added a `selectedProtocol` field which
2015-04-03 23:31:36 +00:00
contains the protocol selected during protocol negotiation.
[alpn]: https://tools.ietf.org/html/rfc7301
2020-04-21 14:28:53 +00:00
## 1.7.0 - 2014-10-15
2015-04-03 23:31:36 +00:00
### Tool changes
2021-07-09 01:34:24 +00:00
- `pub` now generates binstubs for packages that are globally activated so that
2015-04-03 23:31:36 +00:00
they can be put on the user's `PATH` and used as normal executables. See the
[`pub global activate` documentation][pub global activate].
2021-07-09 01:34:24 +00:00
- When using `dart2js` , deferred loading now works with multiple Dart apps on
2015-04-03 23:31:36 +00:00
the same page.
2021-07-09 01:34:24 +00:00
[pub global activate]:
2022-02-08 19:29:56 +00:00
https://dart.dev/tools/pub/cmd/pub-global#running-a-script-from-your-path
2015-04-03 23:31:36 +00:00
### Core library changes
2021-07-09 01:34:24 +00:00
- `dart:async` : `Zone` , `ZoneDelegate` , and `ZoneSpecification` added the
2015-04-03 23:31:36 +00:00
`errorCallback` function, which allows errors that have been programmatically
added to a `Future` or `Stream` to be intercepted.
2021-07-09 01:34:24 +00:00
- `dart:io` :
2015-04-03 23:31:36 +00:00
2021-07-09 01:34:24 +00:00
- **Breaking change:** `HttpClient.close` must be called for all clients or
2015-04-03 23:31:36 +00:00
they will keep the Dart process alive until they time out. This fixes the
handling of persistent connections. Previously, the client would shut down
immediately after a request.
2021-07-09 01:34:24 +00:00
- **Breaking change:** `HttpServer` no longer compresses all traffic by
2015-04-03 23:31:36 +00:00
default. The new `autoCompress` property can be set to `true` to re-enable
compression.
2021-07-09 01:34:24 +00:00
- `dart:isolate` : `Isolate.spawnUri` added the optional `packageRoot` argument,
2021-05-05 18:04:05 +00:00
which controls how it resolves `package:` URIs.