dds
A library used to spawn the Dart Developer Service, used to communicate with a Dart VM Service instance.
5.4.0
6.3M downloads/mo
#111 most downloaded on pub.dev
dart-lang/sdk
What this package is like to depend on
Last release 1 months ago
16 Jul 2026
Release timing varies
gaps range from 2 weeks to 7 months
Nearly every release is documented
notes for 98 of 102 stable releases
3 versions withdrawn
withdrawn after publishing
6 years old
105 releases · first in 2020
3 releases in the last 12 months
see the full history below
Release timeline
105 releases · May 2020 to Jul 2026Releases
latest 60 of 105-
5.4.016 Jul 2026Release notes
Open source →- [DAP] Print truncated text from
dart:developer'slog()if the full string has been collected. - Require devtools_shared ^13.0.0
- [DAP] Print truncated text from
-
5.3.031 Mar 2026Release notes
Open source →- Add
--app-nameoption todart development-service. This is a short, user focused name to describe the application being debugged.
- Add
-
5.2.011 Mar 2026Release notes
Open source →- [DAP]
Stopped(reason: 'entry')events will no longer be lost if an isolate has not yet reached thePauseStartstate when connecting to the VM. - Breaking change: [DAP] Support for the custom
supportsDartUrisclient capability anddart-macro+file:///mappings that supported the Dart macros experiment have been removed. - [DAP]
evaluateNamewill now be correctly set on child variables of variables in theGlobalsscope. - [DAP] Test skips as a result of using
solono longer produceoutputevents, reducing noisy output when running individual tests. Thedart.testNotificationevents themselves are still forwarded.
- [DAP]
-
5.1.008 Aug 2025Release notes
Open source →- Update to version 2.1 of the DDS protocol.
- Deprecate
getAvailableCachedCpuSamplesandgetCachedCpuSamplesRPCs. - Deprecate the
cachedUserTagsparameter ofDartDevelopmentService.startDartDevelopmentService. - Deprecate the
DartDevelopmentService.cachedUserTagsgetter.
-
5.0.423 Jun 2025Release notes
Open source →- [DAP] Breakpoints are now added/removed individually instead of all being cleared and re-added during a
setBreakpointsrequest. This improves performance and can avoid breakpoints flickering between unresolved/resolved when adding new breakpoints in the same file.
- [DAP] Breakpoints are now added/removed individually instead of all being cleared and re-added during a
-
5.0.305 Jun 2025Release notes
Open source →- [DAP] Handle some additional errors if the VM Service is shutting down during an attempt to resume an isolate.
- [DAP] Stack frames with dots in paths will now be parsed and have locations attached to
OutputEventss. - [DAP] Responses to
evaluateRequestthat are lists now includeindexedVariablesto allow for client-side paging.
-
5.0.226 May 2025Release notes
Open source →- [DAP] Handle possible race condition when interacting with web applications
that can cause an
RPCErrorto be thrown if the application's isolate is disposed mid-RPC.
- [DAP] Handle possible race condition when interacting with web applications
that can cause an
-
5.0.121 May 2025Release notes
Open source →- Widen the dependency on
package:shelf_web_socket. - Require Dart SDK v. 3.5.0 or higher.
- Started caching events sent on the 'Timer' stream. The cached events can be retrieved using the
getStreamHistoryRPC.
- Widen the dependency on
-
5.0.009 Jan 2025Release notes
Open source →- [DAP] The debug adapter no longer spawns its own in-process copy of DDS, instead relying on one started by the Dart VM (or
Flutter). This means theenableDdsandenableAuthCodesarguments to theDartDebugAdapterbase class have been deprecated and have any effect. Suppressing DDS (or auth codes) should be done in launch configuration (for example usingvmAdditionalArgsortoolArgsdepending on the target tool). - Updated the
devtools_shareddependency to version^11.0.0. - Made
runDartDevelopmentServiceFromCLIpass the specified bind address directly intostartDartDevelopmentServicewithout resolving the address. - [DAP] Evaluations now use Service ID Zones to more precisely control the lifetime of instance references returned. This should avoid instances being collected while execution is paused, while releasing them once execution resumes.
- Updated
vm_serviceconstraint to>=14.3.0 <16.0.0. - [DAP] Updated
dapconstraint to ^1.4.0. - [DAP] Set
supportsANSIStylingtotruein debug adapter capabilities to indicate thatOutputevents might contain ansi color codes. - [DAP] Stack traces in more formats will be parsed and have locations attached to
OutputEventss. - Update to be forward compatible with
package:shelf_web_socketversion3.x.
- [DAP] The debug adapter no longer spawns its own in-process copy of DDS, instead relying on one started by the Dart VM (or
-
4.2.710 Sep 2024Release notes
Open source →- Added a new constant
RpcErrorCodes.kConnectionDisposed = -32010for requests failing because the service connection was closed. This value is not currently used but is provided for clients to handle in preperation for a future release that will use it to avoid clients having to read error messages. - Loosened type of
google3WorkspaceRootparameter toDartDevelopmentServiceLauncher.startfromUri?toObject?. This parameter will eventually be changed toString?, but will allow bothUri?andString?values for now.
- Added a new constant
-
4.2.629 Aug 2024Release notes
Open source →- [DAP] Fixed an issue where "Service connection disposed" errors may go unhandled during termination/shutdown.
- Add
google3WorkspaceRootparameter toDartDevelopmentServiceLauncher.start.
-
4.2.501 Aug 2024Release notes
Open source →- Fixed DevTools URI not including a trailing '/' before the query parameters, which could prevent DevTools from loading properly.
- [DAP] Fixed an issue where format specifiers and
format.hexinvariablesRequestwould not apply to values from lists such asUint8Listfromdart:typed_data. - Added
package:dds/dds_launcher.dart, a library which can be used to launch DDS instances usingdart development-service.
-
4.2.5+123 Aug 2024Release notes
Open source →- Fix issue where
DartDevelopmentServiceException.fromJsonwould throw aStateErrorwhenever called, except when called to create anExistingDartDevelopmentServiceException.
- Fix issue where
-
4.2.424 Jun 2024 withdrawnNothing published for this version
-
4.2.4+124 Jun 2024Release notes
Open source →- Added missing type to
EventinpostEvent. - [DAP] Instaces with both fields and getters of the same name will no longer show duplicates in
variablesresponses. bin/dds.dartnow closes thestderrpipe after writing its JSON to the stream.
- Added missing type to
-
4.2.4+225 Sep 2024Nothing published for this version
-
4.2.323 May 2024Release notes
Open source →- Added missing await of
WebSocketChannel.readyinstartDartDevelopmentService.
- Added missing await of
-
4.2.222 May 2024Release notes
Open source →- [DAP] Exceptions that occur while the debug adapter is connecting to the VM Service and configuring isolates will no longer cause the debug adapter to terminate. Instead, the errors are reporting via a
consoleOutputEventand the adapter will shut down gracefully.
- [DAP] Exceptions that occur while the debug adapter is connecting to the VM Service and configuring isolates will no longer cause the debug adapter to terminate. Instead, the errors are reporting via a
-
4.2.107 May 2024Release notes
Open source →- [DAP]: Fixed an issue where breakpoint
changedevents might contain incorrect location information when new isolates are created, causing breakpoints to appear to move in the editor. - [DAP]: For consistency with other values, automatic
toString()invocations for debugger views no longer expand long strings and instead show truncated values. Full values continue to be returned for evaluation (context=="repl") and when copying to the clipboard (context=="clipboard"). - [DAP]: Improved handling of sentinel responses when building
variablesresponses. This prevents entire map/list requests from failing when only some values inside are sentinels. - [DAP] Set
requirePermissionToResumeandrequireUserPermissionToResumeforonPauseStartandonPauseExitso that DDS waits for DAP's permission before resuming the isolate.
- [DAP]: Fixed an issue where breakpoint
-
4.2.016 Apr 2024Release notes
Open source →- [DAP] All
OutputEvents are now scanned for stack frames to attachsourcemetadata to. The [parseStackFrames] parameter forsendOutputis ignored and deprecated.
- [DAP] All
-
4.1.012 Apr 2024Release notes
Open source →- Internal change: removed static method
DevToolsUtils.initializeAnalyticsand prepared DDS for usingunified_analyticsthrough the Dart Tooling Daemon. - Internal change: removed
analyticsparameter from the DevTools serverdefaultHandlermethod. - Updated
README.mdand added contributing guide (CONTRIBUTING.md). - Updated
package:dds_service_extensionsconstraint to ^2.0.0. - Determine default
requireUserPermissionToResumevalues from thepause_isolates_on_startandpause_isolates_on_exitflags. - Indicate compatibility with
package:web_socket_channel2.x and 3.x - Indicate compatibility with
package:shelf_web_socket1.x and 2.x - Updated the
devtools_shareddependency to version^9.0.1. - Remove the
package:unified_analyticsdependency. - Serve DevTools extensions from their absolute location.
- Internal change: removed static method
-
4.0.022 Mar 2024Release notes
Open source →- Updated DDS protocol to version 2.0.
- Added
readyToResumeandrequireUserPermissionToResumeRPCs. - Breaking change:
resumeis now treated as a user-initiated resume request and force resumes paused isolates, regardless of required resume approvals. Tooling relying on resume permissions should use thereadyToResumeRPC to indicate to DDS that they are ready to resume.
-
3.4.021 Mar 2024Release notes
Open source →Language
Dart 3.4 makes improvements to the type analysis of conditional expressions (
e1 ? e2 : e3), if-null expressions (e1 ?? e2), if-null assignments (e1 ??= e2), and switch expressions (switch (e) { p1 => e1, ... }). To take advantage of these improvements, set your package's SDK constraint lower bound to 3.4 or greater (sdk: '^3.4.0').-
Breaking Change #54640: The pattern context type schema for cast patterns has been changed from
Object?to_(the unknown type), to align with the specification. This change is not expected to make any difference in practice. -
Breaking Change #54828: The type schema used by the compiler front end to perform type inference on the operand of a null-aware spread operator (
...?) in map and set literals has been made nullable, to match what currently happens in list literals. This makes the compiler front end behavior consistent with that of the analyzer. This change is expected to be very low impact.
Libraries
dart:async- Added option for
ParallelWaitErrorto get some meta-information that it can expose in itstoString, and theIterable<Future>.waitand(Future,...,Future).waitextension methods now provide that information. Should make aParallelWaitErroreasier to log.
dart:cli- Breaking change [#52121][]:
waitForis removed in 3.4.
dart:ffi- Added
Struct.createandUnion.createto create struct and union views of the sequence of bytes stored in a subtype ofTypedData.
dart:io-
Breaking change #53863:
Stdouthas a new fieldlineTerminator, which allows developers to control the line ending used bystdoutandstderr. Classes thatimplement Stdoutmust define thelineTerminatorfield. The default semantics ofstdoutandstderrare not changed. -
Deprecates
FileSystemDeleteEvent.isDirectory, which always returnsfalse.
dart:js_interop-
Fixes an issue with several comparison operators in
JSAnyOperatorExtensionthat were declared to returnJSBooleanbut really returnedbool. This led to runtime errors when trying to use the return values. The implementation now returns aJSBooleanto align with the interface. See issue #55024 for more details. -
Added
ExternalDartReferenceand related conversion functionstoExternalReferenceandtoDartObject. This is a faster alternative toJSBoxedDartObject, but with fewer safety guarantees and fewer interoperability capabilities. See #55187 for more details. -
On dart2wasm,
JSBoxedDartObjectnow is an actual JS object that wraps the opaque Dart value instead of only externalizing the value. Like the JS backends, you'll now get a more useful error when trying to use it in another Dart runtime. -
Added
isAhelper to make type checks easier with interop types. See #54138 for more details.
dart:typed_data-
BREAKING CHANGE #53218 #53785: The unmodifiable view classes for typed data are deprecated.
To create an unmodifiable view of a typed-data object, use the
asUnmodifiableView()methods added in Dart 3.3:Uint8List data = ...; final readOnlyView = data.asUnmodifiableView(); // readOnlyView has type Uint8List, and throws if attempted modified.The reason for this change is to allow more flexibility in the implementation of typed data, so the native and web platforms can use different strategies to ensure that typed data has good performance.
The deprecated types will be removed in Dart 3.5.
Tools
Analyzer
-
Improved code completion. Fixed over 50% of completion correctness bugs, tagged
analyzer-completion-correctnessin the issue tracker. -
Support for new annotations introduced in version 1.14.0 of the meta package.
-
Support for the
@doNotSubmitannotation, noting that any usage of an annotated member should not be submitted to source control. -
Support for the
@mustBeConstannotation, which indicates that an annotated parameter only accepts constant arguments.
-
Linter
- Added the
unnecessary_library_namelint. - Added the
missing_code_block_language_in_doc_commentlint.
Compilers
- The compilation environment will no longer pretend to contain entries with
value
""for alldart.library.foostrings, wheredart:foois not an available library. Instead there will only be entries for the available libraries, likedart.library.core, where the value was, and still is,"true". This should have no effect onconst bool.fromEnvironment(...)orconst String.fromEnvironment(...)without adefaultValueargument, an argument which was always ignored previously. It changes the behavior ofconst bool.hasEnvironment(...)on such an input, away from always beingtrueand therefore useless.
DevTools
- Updated DevTools to version 2.33.0 from 2.31.1. To learn more, check out the release notes for versions 2.32.0 and 2.33.0.
Pub
-
Dependency resolution and
dart pub outdatedwill now surface if a dependency is affected by a security advisory, unless the advisory is listed under aignored_advisoriessection in thepubspec.yamlfile. To learn more about pub's support for security advisories, visit dart.dev/go/pub-security-advisories. -
path-dependencies insidegit-dependencies are now resolved relative to the git repo. -
All
dart pubcommands can now be run from any subdirectory of a project. Pub will find the first parent directory with apubspec.yamland operate relative it. -
New command
dart pub unpackthat downloads a package from pub.dev and extracts it to a subfolder of the current directory.This can be useful for inspecting the code, or playing with examples.
Dart Runtime
-
Dart VM flags and options can now be provided to any executable generated using
dart compile exevia theDART_VM_OPTIONSenvironment variable.DART_VM_OPTIONSshould be set to a list of comma-separated flags and options with no whitespace. Options that allow for multiple values to be provided as comma-separated values are not supported (e.g.,--timeline-streams=Dart,GC,Compiler).Example of a valid
DART_VM_OPTIONSenvironment variable:DART_VM_OPTIONS=--random_seed=42,--verbose_gc -
Dart VM no longer supports external strings:
Dart_IsExternalString,Dart_NewExternalLatin1StringandDart_NewExternalUTF16Stringfunctions are removed from Dart C API.
Release notes
Open source →- Start the Dart Tooling Daemon from the DevTools server when a connection is not passed to the server on start.
-
-
3.3.118 Mar 2024Release notes
Open source →This is a patch release that:
- Fixes an issue in dart2js where object literal constructors in interop
extension types would fail to compile without an
@JSannotation on the library (issue #55057). - Disallows certain types involving extension types from being used as the
operand of an
awaitexpression, unless the extension type itself implementsFuture(issue #55095).
Release notes
Open source →- [DAP] Fixed an issue introduced in 3.3.0 where
Source.namecould contain a file paths when apackage:ordart:URI should have been used. - Updated
package:devtools_sharedversion to ^8.0.1.
- Fixes an issue in dart2js where object literal constructors in interop
extension types would fail to compile without an
-
3.3.015 Mar 2024Release notes
Open source →Language
Dart 3.3 adds extension types to the language. To use them, set your package's [SDK constraint][language version] lower bound to 3.3 or greater (
sdk: '^3.3.0').Extension types
An extension type wraps an existing type with a different, static-only interface. It works in a way which is in many ways similar to a class that contains a single final instance variable holding the wrapped object, but without the space and time overhead of an actual wrapper object.
Extension types are introduced by extension type declarations. Each such declaration declares a new named type (not just a new name for the same type). It declares a representation variable whose type is the representation type. The effect of using an extension type is that the representation (that is, the value of the representation variable) has the members declared by the extension type rather than the members declared by its "own" type (the representation type). Example:
extension type Meters(int value) { String get label => '${value}m'; Meters operator +(Meters other) => Meters(value + other.value); } void main() { var m = Meters(42); // Has type `Meters`. var m2 = m + m; // OK, type `Meters`. // int i = m; // Compile-time error, wrong type. // m.isEven; // Compile-time error, no such member. assert(identical(m, m.value)); // Succeeds. }The declaration
Metersis an extension type that has representation typeint. It introduces an implicit constructorMeters(int value);and a getterint get value.mandm.valueis the very same object, butmhas typeMetersandm.valuehas typeint. The point is thatmhas the members ofMetersandm.valuehas the members ofint.Extension types are entirely static, they do not exist at run time. If
ois the value of an expression whose static type is an extension typeEwith representation typeR, thenois just a normal object whose run-time type is a subtype ofR, exactly like the value of an expression of typeR. Also the run-time value ofEisR(for example,E == Ris true). In short: At run time, an extension type is erased to the corresponding representation type.A method call on an expression of an extension type is resolved at compile-time, based on the static type of the receiver, similar to how extension method calls work. There is no virtual or dynamic dispatch. This, combined with no memory overhead, means that extension types are zero-cost wrappers around their representation value.
While there is thus no performance cost to using extension types, there is a safety cost. Since extension types are erased at compile time, run-time type tests on values that are statically typed as an extension type will check the type of the representation object instead, and if the type check looks like it tests for an extension type, like
is Meters, it actually checks for the representation type, that is, it works exactly likeis intat run time. Moreover, as mentioned above, if an extension type is used as a type argument to a generic class or function, the type variable will be bound to the representation type at run time. For example:void main() { var meters = Meters(3); // At run time, `Meters` is just `int`. print(meters is int); // Prints "true". print(<Meters>[] is List<int>); // Prints "true". // An explicit cast is allowed and succeeds as well: List<Meters> meterList = <int>[1, 2, 3] as List<Meters>; print(meterList[1].label); // Prints "2m". }Extension types are useful when you are willing to sacrifice some run-time encapsulation in order to avoid the overhead of wrapping values in instances of wrapper classes, but still want to provide a different interface than the wrapped object. An example of that is interop, where you may have data that are not Dart objects to begin with (for example, raw JavaScript objects when using JavaScript interop), and you may have large collections of objects where it's not efficient to allocate an extra object for each element.
Other changes
-
Breaking Change #54056: The rules for private field promotion have been changed so that an abstract getter is considered promotable if there are no conflicting declarations. There are no conflicting declarations if there are no non-final fields, external fields, concrete getters, or
noSuchMethodforwarding getters with the same name in the same library. This makes the implementation more consistent and allows type promotion in a few rare scenarios where it wasn't previously allowed. It is unlikely, but this change could cause a breakage by changing an inferred type in a way that breaks later code. For example:class A { int? get _field; } class B extends A { final int? _field; B(this._field); } test(A a) { if (a._field != null) { var x = a._field; // Previously had type `int?`; now has type `int` ... x = null; // Previously allowed; now causes a compile-time error. } }Affected code can be fixed by adding an explicit type annotation. For example, in the above snippet,
var xcan be changed toint? x.It's also possible that some continuous integration configurations might fail if they have been configured to treat warnings as errors, because the expanded type promotion could lead to one of the following warnings:
unnecessary_non_null_assertionunnecessary_castinvalid_null_aware_operator
These warnings can be addressed in the usual way, by removing the unnecessary operation in the first two cases, or changing
?.to.in the third case.To learn more about other rules surrounding type promotion, check out the guide on Fixing type promotion failures.
Libraries
dart:coreString.fromCharCodesnow allowstartandendto be after the end of theIterableargument, just likeskipandtakedoes on anIterable.
dart:ffi- In addition to functions,
@Nativecan now be used on fields. - Allow taking the address of native functions and fields via
Native.addressOf. - The
elementAtpointer arithmetic extension methods on corePointertypes are now deprecated. Migrate to the new-and+operators instead. - The experimental and deprecated
@FfiNativeannotation has been removed. Usages should be updated to use the@Nativeannotation.
dart:js_interop- Breaking Change in the representation of JS types #52687: JS types
like
JSAnywere previously represented using a custom erasure of@staticInteroptypes that were compiler-specific. They are now represented as extension types where their representation types are compiler-specific. This means that user-defined@staticInteroptypes that implementedJSAnyorJSObjectcan no longer do so and need to useJSObject.fromInteropObject. Going forward, it's recommended to use extension types to define interop APIs. Those extension types can still implement JS types. - JSArray and JSPromise generics:
JSArrayandJSPromiseare now generic types whose type parameter is a subtype ofJSAny?. Conversions to and from these types are changed to account for the type parameters of the Dart or JS type, respectively. - Breaking Change in names of extensions: Some
dart:js_interopextension members are moved to different extensions on the same type or a supertype to better organize the API surface. SeeJSAnyUtilityExtensionandJSAnyOperatorExtensionfor the new extensions. This shouldn't make a difference unless the extension names were explicitly used. - Add
importModuleto allow users to dynamically import modules using the JSimport()expression.
dart:js_interop_unsafe- Add
hashelper to makehasPropertycalls more concise.
dart:typed_data-
BREAKING CHANGE (https://github.com/dart-lang/sdk/issues/53218) The unmodifiable view classes for typed data are deprecated. Instead of using the constructors for these classes to create an unmodifiable view, e.g.
Uint8List data = ... final readOnlyView = UnmodifiableUint8ListView(data);use the new
asUnmodifiableView()methods:Uint8List data = ... final readOnlyView = data.asUnmodifiableView();The reason for this change is to allow more flexibility in the implementation of typed data so the native and web platforms can use different strategies for ensuring typed data has good performance.
The deprecated types will be removed in a future Dart version.
dart:nativewrappers- Breaking Change #51896: The NativeWrapperClasses are marked
baseso that none of their subtypes can be implemented. Implementing subtypes can lead to crashes when passing such native wrapper to a native call, as it will try to unwrap a native field that doesn't exist.
Tools
Dart command line
- The
dart createcommand now uses v3 ofpackage:lints, including multiple new recommended lints by default. To learn more about the updated collection of lints, check out thepackage:lints3.0.0 changelog entry.
DevTools
- Updated DevTools to version 2.31.1 from 2.28.1. To learn more, check out the release notes for versions 2.29.0, 2.30.0, and 2.31.0.
Wasm compiler (dart2wasm)
- Breaking Change #54004:
dart:js_util,package:js, anddart:jsare now disallowed from being imported when compiling withdart2wasm. Prefer usingdart:js_interopanddart:js_interop_unsafe.
Development JavaScript compiler (DDC)
-
Type arguments of
package:jsinterop types are now printed asanyinstead of being omitted. This is simply a change to the textual representation of package js types that have type arguments. These type arguments are still completely ignored by the type system at runtime. -
Removed "implements <...>" text from the Chrome custom formatter display for Dart classes. This information provides little value and keeping it imposes an unnecessary maintenance cost.
Production JavaScript compiler (dart2js)
- Breaking Change #54201:
The
Invocationthat is passed tonoSuchMethodwill no longer have a minifiedmemberName, even when dart2js is invoked with--minify. See #54201 for more details.
Analyzer
- You can now suppress diagnostics in
pubspec.yamlfiles by adding an# ignore: <diagnostic_id>comment. - Invalid
dart doccomment directives are now reported. - The
flutter_style_todoslint now has a quick fix.
Linter
- Removed the
iterable_contains_unrelated_typeandlist_remove_unrelated_typelints. Consider migrating to the expandedcollection_methods_unrelated_typelint. - Removed various lints that are no longer necessary with sound null safety:
always_require_non_null_named_parametersavoid_returning_null,avoid_returning_null_for_future
Release notes
Open source →- Breaking change: [DAP] Several signatures in DAP debug adapter classes have been updated to use
Uris where they previously usedString paths. This is to support communicating with the DAP client using URIs instead of file paths. URIs may be used only when the client sets the customsupportsDartUrisclient capability during initialization. - [DAP] Added support for using mapping
dart-macro+file:///URIs in communication with the client if thesupportsDartUrisflag is set in arguments forinitializeRequest. - Fixed issue where DDS would fail to initialize when an isolate in the target process was unable to handle service requests (b/323386606).
- Updated
package:dapversion to 1.2.0.
-
-
3.2.122 Feb 2024Release notes
Open source →This is a patch release that:
-
Fixes the left/mobile sidebar being empty on non-class pages in documentation generated with
dart doc(issue #54073). -
Fixes a JSON array parsing bug that causes a segmentation fault when
flutter testis invoked with the--coverageflag (SDK issue #54059, Flutter issue #124145). -
Upgrades Dart DevTools to version 2.28.3 (issue #54085).
Release notes
Open source →- Adding
unified_analyticsas a dependency and added static methodDevToolsUtils.initializeAnalyticsto create analytics instance for DevTools. - Updated
devtools_sharedconstraint to ^7.0.0.
-
-
3.2.013 Feb 2024Release notes
Open source →Language
Dart 3.2 adds the following features. To use them, set your package's SDK constraint lower bound to 3.2 or greater (
sdk: '^3.2.0').-
Private field promotion: In most circumstances, the types of private final fields can now be promoted by null checks and
istests. For example:class Example { final int? _privateField; Example(this._privateField); f() { if (_privateField != null) { // _privateField has now been promoted; you can use it without // null checking it. int i = _privateField; // OK } } } // Private field promotions also work from outside of the class: f(Example x) { if (x._privateField != null) { int i = x._privateField; // OK } }To ensure soundness, a field is not eligible for field promotion in the following circumstances:
- If it's not final (because a non-final field could be changed in between the test and the usage, invalidating the promotion).
- If it's overridden elsewhere in the library by a concrete getter or a non-final field (because an access to an overridden field might resolve at runtime to the overriding getter or field).
- If it's not private (because a non-private field might be overridden elsewhere in the program).
- If it has the same name as a concrete getter or a non-final field in some other unrelated class in the library (because a class elsewhere in the program might extend one of the classes and implement the other, creating an override relationship between them).
- If there is a concrete class
Cin the library whose interface contains a getter with the same name, butCdoes not have an implementation of that getter (such unimplemented getters aren't safe for field promotion, because they are implicitly forwarded tonoSuchMethod, which might not return the same value each time it's called).
-
Breaking Change #53167: Use a more precise split point for refutable patterns. Previously, in an if-case statement, if flow analysis could prove that the scrutinee expression was guaranteed to throw an exception, it would sometimes fail to propagate type promotions implied by the pattern to the (dead) code that follows. This change makes the type promotion behavior of if-case statements consistent regardless of whether the scrutinee expression throws an exception.
No live code is affected by this change, but there is a small chance that the change in types will cause a compile-time error to appear in some dead code in the user's project, where no compile-time error appeared previously.
Libraries
dart:async- Added
broadcastparameter toStream.emptyconstructor.
dart:cli- Breaking change #52121:
waitForis disabled by default and slated for removal in 3.4. Attempting to call this function will now throw an exception. Users that still depend onwaitForcan enable it by passing--enable_deprecated_wait_forflag to the VM.
dart:convert- Breaking change #52801:
- Changed return types of
utf8.encode()andUtf8Codec.encode()fromList<int>toUint8List.
- Changed return types of
dart:developer- Deprecated the
Service.getIsolateIDmethod. - Added
getIsolateIdmethod toService. - Added
getObjectIdmethod toService.
dart:ffi- Added the
NativeCallable.isolateLocalconstructor. This createsNativeCallables with the same functionality asPointer.fromFunction, except thatNativeCallableaccepts closures. - Added the
NativeCallable.keepIsolateAlivemethod, which determines whether theNativeCallablekeeps the isolate that created it alive. - All
NativeCallableconstructors can now accept closures. PreviouslyNativeCallables had the same restrictions asPointer.fromFunction, and could only create callbacks for static functions. - Breaking change #53311:
NativeCallable.nativeFunctionnow throws an error if is called after theNativeCallablehas already beenclosed. Calls tocloseafter the first are now ignored.
dart:io-
Breaking change #53005: The headers returned by
HttpClientResponse.headersandHttpRequest.headersno longer include trailing whitespace in their values. -
Breaking change #53227: Folded headers values returned by
HttpClientResponse.headersandHttpRequest.headersnow have a space inserted at the fold point.
dart:isolate- Added
Isolate.packageConfigSyncandIsolate.resolvePackageUriSyncAPIs.
dart:js_interop- Breaking Change on JSNumber.toDart and Object.toJS:
JSNumber.toDartis removed in favor oftoDartDoubleandtoDartIntto make the type explicit.Object.toJSis also removed in favor ofObject.toJSBox. Previously, this function would allow Dart objects to flow into JS unwrapped on the JS backends. Now, there's an explicit wrapper that is added and unwrapped viaJSBoxedDartObject.toDart. Similarly,JSExportedDartObjectis renamed toJSBoxedDartObjectand the extensionsObjectToJSExportedDartObjectandJSExportedDartObjectToObjectare renamed toObjectToJSBoxedDartObjectandJSBoxedDartObjectToObjectin order to avoid confusion with@JSExport. - Type parameters in external APIs:
Type parameters must now be bound to a static interop type or one of the
dart:js_interoptypes likeJSNumberwhen used in an external API. This only affectsdart:js_interopclasses and notpackage:jsor other forms of JS interop. - Subtyping
dart:js_interoptypes:@staticInteroptypes can subtype onlyJSObjectandJSAnyfrom the set of JS types indart:js_interop. Subtyping other types fromdart:js_interopwould result in confusing type errors before, so this makes it a static error. - Global context of
dart:js_interopand@staticInteropAPIs: Static interop APIs will now use the same global context as non-static interop instead ofglobalThisto avoid a greater migration. Static interop APIs, either throughdart:js_interopor the@staticInteropannotation, have used JavaScript'sglobalThisas the global context. This is relevant to things like external top-level members or external constructors, as this is the root context we expect those members to reside in. Historically, this was not the case in dart2js and DDC. We used eitherselfor DDC'sglobalin non-static interop APIs withpackage:js. So, static interop APIs will now use one of those global contexts. Functionally, this should matter in only a very small number of cases, like when using older browser versions.dart:js_interop'sglobalJSObjectis also renamed toglobalContextand returns the global context used in the lowerings. - Breaking Change on Types of
dart:js_interopExternal APIs: External JS interop APIs when usingdart:js_interopare restricted to a set of allowed types. Namely, this includes the primitive types likeString, JS types fromdart:js_interop, and other static interop types (either through@staticInteropor extension types). - Breaking Change on
dart:js_interopisNullandisUndefined:nullandundefinedcan only be discerned in the JS backends. dart2wasm conflates the two values and treats them both as Dart null. Therefore, these two helper methods should not be used on dart2wasm and will throw to avoid potentially erroneous code. - Breaking Change on
dart:js_interoptypeofEqualsandinstanceof: Both APIs now return aboolinstead of aJSBoolean.typeofEqualsalso now takes in aStringinstead of aJSString. - Breaking Change on
dart:js_interopJSAnyandJSObject: These types can only be implemented, and no longer extended, by user@staticInteroptypes. - Breaking Change on
dart:js_interopJSArray.withLength: This API now takes in anintinstead ofJSNumber.
Tools
Development JavaScript compiler (DDC)
- Applications compiled by DDC will no longer add members to the native JavaScript Object prototype.
- Breaking change for JS interop with Symbols and BigInts:
JavaScript
Symbols andBigInts are now associated with their own interceptor and should not be used withpackage:jsclasses. These types were being intercepted with the assumption that they are a subtype of JavaScript'sObject, but this is incorrect. This lead to erroneous behavior when using these types as DartObjects. See #53106 for more details. Usedart:js_interop'sJSSymbolandJSBigIntwith extension types to interop with these types.
Production JavaScript compiler (dart2js)
- Breaking change for JS interop with Symbols and BigInts:
JavaScript
Symbols andBigInts are now associated with their own interceptor and should not be used withpackage:jsclasses. These types were being intercepted with the assumption that they are a subtype of JavaScript'sObject, but this is incorrect. This lead to erroneous behavior when using these types as DartObjects. See #53106 for more details. Usedart:js_interop'sJSSymbolandJSBigIntwith extension types to interop with these types.
Dart command line
- The
dart createcommand has a newclitemplate to quickly create Dart command-line applications with basic argument parsing capabilities. To learn more about using the template, rundart help create.
Dart format
- Always split enum declarations containing a line comment.
- Fix regression in splitting type annotations with library prefixes.
- Support
--enable-experimentcommand-line option to enable language experiments.
DevTools
Linter
- Added the experimental
annotate_redeclareslint. - Marked the
use_build_context_synchronouslylint as stable.
Pub
- New option
dart pub upgrade --tightenwhich will update dependencies' lower bounds inpubspec.yamlto match the current version. - The commands
dart pub get/add/upgradewill now show if a dependency changed between direct, dev and transitive dependency. - The command
dart pub upgradeno longer shows unchanged dependencies.
Release notes
Open source →- [DAP] Fixed "Unable to find library" errors when using global evaluation when the context file resolves to a
package:URI. - Updated
devtools_sharedto ^6.0.4. - Added
--dtd-uri=<uri>flag to DevTools server. - Updated
vm_serviceconstraint to ^14.0.0.
-
-
3.1.203 Jan 2024Release notes
Open source →This is a patch release that:
-
Fixes a bug in dart2js which crashed the compiler when a typed record pattern was used outside the scope of a function body, such as in a field initializer. For example
final x = { for (var (int a,) in someList) a: a };(issue #53449) -
Fixes an expedient issue of users seeing an unhandled exception pause in the debugger, please see https://github.com/dart-lang/sdk/issues/53450 for more details. The fix uses try/catch in lookupAddresses instead of Future error so that we don't see an unhandled exception pause in the debugger (issue #53450)
Release notes
Open source →- Improved error handling for serving static DevTools assets.
- Updated
devtools_sharedconstraint to ^6.0.3. - [DAP] The error message shown when global evaluation is unavailable been improved.
- [DAP] Error messages shown on the client no longer contain verbose stack traces (although they are still included in the JSON payloads).
- [DAP]
stackTraceRequestnow returns an empty stack instead of throwing if called for a thread that has exited. - [DAP] Fixed an issue that could cause a crash during shutdown if an isolate was being resumed.
- Updated
vm_serviceconstraint to ^13.0.0.
-
-
3.1.115 Dec 2023Release notes
Open source →This is a patch release that:
- Fixes a bug in the parser which prevented a record pattern from containing a
nested record pattern, where the nested record pattern uses record
destructuring shorthand syntax, for example
final ((:a, :b), c) = record;(issue #53352).
- Fixes a bug in the parser which prevented a record pattern from containing a
nested record pattern, where the nested record pattern uses record
destructuring shorthand syntax, for example
-
3.1.025 Oct 2023Release notes
Open source →Libraries
dart:async- Breaking change #52334:
- Added the
interfacemodifier to purely abstract classes:MultiStreamController,StreamConsumer,StreamIteratorandStreamTransformer. As a result, these types can only be implemented, not extended or mixed in.
- Added the
dart:coreUri.baseon native platforms now respectsIOOverridesoverriding current directory (#39796).
dart:ffi- Added the
NativeCallableclass, which can be used to create callbacks that allow native code to call into Dart code from any thread. SeeNativeCallable.listener. In future releases,NativeCallablewill be updated with more functionality, and will become the recommended way of creating native callbacks for all use cases, replacingPointer.fromFunction.
dart:io- Breaking change #51486:
- Added
sameSiteto theCookieclass. - Added class
SameSite.
- Added
- Breaking change #52027:
FileSystemEventissealed. This means thatFileSystemEventcannot be extended or implemented. - Added a deprecation warning when
Platformis instantiated. - Added
Platform.lineTerminatorwhich exposes the character or characters that the operating system uses to separate lines of text, e.g.,"\r\n"on Windows.
dart:js_interop- Object literal constructors:
ObjectLiteralis removed fromdart:js_interop. It's no longer needed in order to declare an object literal constructor with inline classes. As long as an external constructor has at least one named parameter, it'll be treated as an object literal constructor. If you want to create an object literal with no named members, use{}.jsify().
Other libraries
package:js- Breaking change to
@staticInteropandexternalextension members:external@staticInteropmembers andexternalextension members can no longer be used as tear-offs. Declare a closure or a non-externalmethod that calls these members, and use that instead. - Breaking change to
@staticInteropandexternalextension members:external@staticInteropmembers andexternalextension members will generate slightly different JS code for methods that have optional parameters. Whereas before, the JS code passed in the default value for missing optionals, it will now pass in only the provided members. This aligns with how JS parameters work, where omitted parameters are actually omitted. For example, callingexternal void foo([int a, int b])asfoo(0)will now result infoo(0), and notfoo(0, null).
Tools
DevTools
Linter
- Added new static analysis lints you can enable in
your package's
analysis_options.yamlfile:
- Breaking change #52334:
-
3.1.0+104 Jan 2024Release notes
Open source →Hot-fix release of changes in 3.1.2 without the changes in 3.1.1
- Improved error handling for serving static DevTools assets.
- Updated
devtools_sharedconstraint to ^6.0.3. - [DAP] The error message shown when global evaluation is unavailable been improved.
- [DAP] Error messages shown on the client no longer contain verbose stack traces (although they are still included in the JSON payloads).
- [DAP]
stackTraceRequestnow returns an empty stack instead of throwing if called for a thread that has exited. - [DAP] Fixed an issue that could cause a crash during shutdown if an isolate was being resumed.
-
3.0.023 Oct 2023Release notes
Open source →Language
Dart 3.0 adds the following features. To use them, set your package's SDK constraint lower bound to 3.0 or greater (
sdk: '^3.0.0').-
Records: Records are anonymous immutable data structures that let you aggregate multiple values together, similar to tuples in other languages. With records, you can return multiple values from a function, create composite map keys, or use them any other place where you want to bundle a couple of objects together.
For example, using a record to return two values:
(double x, double y) geoLocation(String name) { if (name == 'Nairobi') { return (-1.2921, 36.8219); } else { ... } } -
Pattern matching: Expressions build values out of smaller pieces. Conversely, patterns are an expressive tool for decomposing values back into their constituent parts. Patterns can call getters on an object, access elements from a list, pull fields out of a record, etc. For example, we can destructure the record from the previous example like so:
var (lat, long) = geoLocation('Nairobi'); print('Nairobi is at $lat, $long.');Patterns can also be used in switch cases. There, you can destructure values and also test them to see if they have a certain type or value:
switch (object) { case [int a]: print('A list with a single integer element $a'); case ('name', _): print('A two-element record whose first field is "name".'); default: print('Some other object.'); }Also, as you can see, non-empty switch cases no longer need
break;statements.Breaking change: Dart 3.0 interprets switch cases as patterns instead of constant expressions. Most constant expressions found in switch cases are valid patterns with the same meaning (named constants, literals, etc.). You may need to tweak a few constant expressions to make them valid. This only affects libraries that have upgraded to language version 3.0.
-
Switch expressions: Switch expressions allow you to use patterns and multi-way branching in contexts where a statement isn't allowed:
return TextButton( onPressed: _goPrevious, child: Text(switch (page) { 0 => 'Exit story', 1 => 'First page', _ when page == _lastPage => 'Start over', _ => 'Previous page', }), ); -
If-case statements and elements: A new if construct that matches a value against a pattern and executes the then or else branch depending on whether the pattern matches:
if (json case ['user', var name]) { print('Got user message for user $name.'); }There is also a corresponding if-case element that can be used in collection literals.
-
Sealed classes: When you mark a type
sealed, the compiler ensures that switches on values of that type exhaustively cover every subtype. This enables you to program in an algebraic datatype style with the compile-time safety you expect:sealed class Amigo {} class Lucky extends Amigo {} class Dusty extends Amigo {} class Ned extends Amigo {} String lastName(Amigo amigo) => switch (amigo) { Lucky _ => 'Day', Ned _ => 'Nederlander', };In this last example, the compiler reports an error that the switch doesn't cover the subclass
Dusty. -
Class modifiers: New modifiers
final,interface,base, andmixinonclassandmixindeclarations let you control how the type can be used. By default, Dart is flexible in that a single class declaration can be used as an interface, a superclass, or even a mixin. This flexibility can make it harder to evolve an API over time without breaking users. We mostly keep the current flexible defaults, but these new modifiers give you finer-grained control over how the type can be used.Breaking change: Class declarations from libraries that have been upgraded to Dart 3.0 can no longer be used as mixins by default. If you want the class to be usable as both a class and a mixin, mark it
mixin class. If you want it to be used only as a mixin, make it amixindeclaration. If you haven't upgraded a class to Dart 3.0, you can still use it as a mixin. -
Breaking change #50902: Dart reports a compile-time error if a
continuestatement targets a label that is not a loop (for,doandwhilestatements) or aswitchmember. Fix this by changing thecontinueto target a valid labeled statement. -
Breaking change language/#2357: Starting in language version 3.0, Dart reports a compile-time error if a colon (
:) is used as the separator before the default value of an optional named parameter. Fix this by changing the colon (:) to an equal sign (=).
Libraries
General changes
- Breaking Change: Non-
mixinclasses in the platform libraries can no longer be mixed in, unless they are explicitly marked asmixin class. The following existing classes have been made mixin classes:IterableIterableMixin(now alias forIterable)IterableBase(now alias forIterable)ListMixinSetMixinMapMixinLinkedListEntryStringConversionSink
dart:core-
Added
bool.parseandbool.tryParsestatic methods. -
Added
DateTime.timestamp()constructor to get current time as UTC. -
The type of
RegExpMatch.patternis nowRegExp, not justPattern. -
Breaking change #49529:
- Removed the deprecated
Listconstructor, as it wasn't null safe. Use list literals (e.g.[]for an empty list or<int>[]for an empty typed list) orList.filled. - Removed the deprecated
onErrorargument onint.parse,double.parse, andnum.parse. Use thetryParsemethod instead. - Removed the deprecated
proxyandProvisionalannotations. The originalproxyannotation has no effect in Dart 2, and theProvisionaltype andprovisionalconstant were only used internally during the Dart 2.0 development process. - Removed the deprecated
Deprecated.expiresgetter. UseDeprecated.messageinstead. - Removed the deprecated
CastErrorerror. UseTypeErrorinstead. - Removed the deprecated
FallThroughErrorerror. The kind of fall-through previously throwing this error was made a compile-time error in Dart 2.0. - Removed the deprecated
NullThrownErrorerror. This error is never thrown from null safe code. - Removed the deprecated
AbstractClassInstantiationErrorerror. It was made a compile-time error to call the constructor of an abstract class in Dart 2.0. - 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. - Removed the deprecated
NoSuchMethodErrordefault constructor. Use theNoSuchMethodError.withInvocationnamed constructor instead. - Removed the deprecated
BidirectionalIteratorclass. Existing bidirectional iterators can still work, they just don't have a shared supertype locking them to a specific name for moving backwards.
- Removed the deprecated
-
Breaking change when migrating code to Dart 3.0: Some changes to platform libraries only affect code when that code is migrated to language version 3.0.
-
The
Functiontype can no longer be implemented, extended or mixed in. Since Dart 2.0 writingimplements Functionhas been allowed for backwards compatibility, but it has not had any effect. In Dart 3.0, theFunctiontype isfinaland cannot be subtyped, preventing code from mistakenly assuming it works. -
The following declarations can only be implemented, not extended:
ComparableExceptionIteratorPatternMatchRegExpRegExpMatchStackTraceStringSink
None of these declarations contained any implementation to inherit, and are marked as
interfaceto signify that they are only intended as interfaces. -
The following declarations can no longer be implemented or extended:
MapEntryOutOfMemoryErrorStackOverflowErrorExpandoWeakReferenceFinalizer
The
MapEntryvalue class is restricted to enable later optimizations. The remaining classes are tightly coupled to the platform and not intended to be subclassed or implemented.
-
dart:async-
Added extension member
waiton iterables and 2-9 tuples of futures. -
Breaking change #49529:
- Removed the deprecated
DeferredLibraryclass. Use thedeferred asimport syntax instead.
- Removed the deprecated
dart:collection-
Added extension members
nonNulls,firstOrNull,lastOrNull,singleOrNull,elementAtOrNullandindexedonIterables. Also exported fromdart:core. -
Deprecated the
HasNextIteratorclass (#50883). -
Breaking change when migrating code to Dart 3.0: Some changes to platform libraries only affect code when it is migrated to language version 3.0.
- The following interface can no longer be extended, only implemented:
Queue
- The following implementation classes can no longer be implemented:
LinkedListLinkedListEntry
- The following implementation classes can no longer be implemented
or extended:
HasNextIterator(Also deprecated.)HashMapLinkedHashMapHashSetLinkedHashSetDoubleLinkedQueueListQueueSplayTreeMapSplayTreeSet
- The following interface can no longer be extended, only implemented:
dart:developer-
Breaking change #49529:
- Removed the deprecated
MAX_USER_TAGSconstant. UsemaxUserTagsinstead.
- Removed the deprecated
-
Callbacks passed to
registerExtensionwill be run in the zone from which they are registered. -
Breaking change #50231:
dart:ffi- The experimental
@FfiNativeannotation is now deprecated. Usages should be replaced with the new@Nativeannotation.
dart:html- Breaking change: As previously announced, the deprecated
registerElementandregisterElement2methods inDocumentandHtmlDocumenthave been removed. See #49536 for details.
dart:math- Breaking change when migrating code to Dart 3.0:
Some changes to platform libraries only affect code when it is migrated
to language version 3.0.
- The
Randominterface can only be implemented, not extended.
- The
dart:io- Added
nameandsignalNumberto theProcessSignalclass. - Deprecate
NetworkInterface.listSupported. Has always returned true since Dart 2.3. - Finalize
httpEnableTimelineLoggingparameter name transition fromenabletoenabled. See #43638. - Favor IPv4 connections over IPv6 when connecting sockets. See #50868.
- Breaking change #51035:
- Update
NetworkProfilingto accommodate newStringids that are introduced in vm_service:11.0.0
- Update
dart:js_util- Added several helper functions to access more JavaScript operators, like
deleteand thetypeoffunctionality. jsifyis now permissive and has inverse semantics todartify.jsifyanddartifyboth handle types they understand natively more efficiently.- Signature of
callMethodhas been aligned with the other methods and now takesObjectinstead ofString.
Tools
Observatory
- Observatory is no longer served by default and users should instead use Dart
DevTools. Users requiring specific functionality in Observatory should set
the
--serve-observatoryflag.
Web Dev Compiler (DDC)
- Removed deprecated command line flags
-k,--kernel, and--dart-sdk. - The compile time flag
--nativeNonNullAsserts, which ensures web library APIs are sound in their nullability, is by default set to true in sound mode. For more information on the flag, see NATIVE_NULL_ASSERTIONS.md.
dart2js
- The compile time flag
--native-null-assertions, which ensures web library APIs are sound in their nullability, is by default set to true in sound mode, unless-O3or higher is passed, in which case they are not checked. For more information on the flag, see NATIVE_NULL_ASSERTIONS.md.
Dart2js
- Cleanup related to #46100:
the internal dart2js snapshot fails unless it is called from a supported
interface, such as
dart compile js,flutter build, orbuild_web_compilers. This is not expected to be a visible change.
Formatter
- Format
sync*andasync*functions with=>bodies. - Don't split after
<in collection literals. - Better indentation of multiline function types inside type argument lists.
- Fix bug where parameter metadata wouldn't always split when it should.
Analyzer
- Most static analysis "hints" are converted to be "warnings," and any
remaining hints are intended to be converted soon after the Dart 3.0 release.
This means that any (previously) hints reported by
dart analyzeare now considered "fatal" (will result in a non-zero exit code). The previous behavior, where such hints (now warnings) are not fatal, can be achieved by using the--no-fatal-warningsflag. This behavior can also be altered, on a code-by-code basis, by changing the severity of rules in an analysis options file. - Add static enforcement of the SDK-only
@Sinceannotation. When code in a package uses a Dart SDK element annotated with@Since, analyzer will report a warning if the package's Dart SDK constraint allows versions of Dart which don't include that element. - Protects the Dart Analysis Server against extreme memory usage by limiting the number of plugins per analysis context to 1. (issue [#50981][]).
Linter
Updates the Linter to
1.35.0, which includes changes that- add new lints:
implicit_reopenunnecessary_breakstype_literal_in_constant_patterninvalid_case_patterns
- update existing lints to support patterns and class modifiers
- remove support for:
enable_null_safetyinvariant_booleansprefer_bool_in_assertsprefer_equal_for_default_valuessuper_goes_last
- fix
unnecessary_parenthesisfalse-positives with null-aware expressions. - fix
void_checksto allow assignments ofFuture<dynamic>?to parameters typedFutureOr<void>?. - fix
use_build_context_synchronouslyin if conditions. - fix a false positive for
avoid_private_typedef_functionswith generalized type aliases. - update
unnecessary_parenthesisto detect some doubled parens. - update
void_checksto allow returningNeveras void. - update
no_adjacent_strings_in_listto support set literals and for- and if-elements. - update
avoid_types_as_parameter_namesto handle type variables. - update
avoid_positional_boolean_parametersto handle typedefs. - update
avoid_redundant_argument_valuesto check parameters of redirecting constructors. - improve performance for
prefer_const_literals_to_create_immutables. - update
use_build_context_synchronouslyto check context properties. - improve
unnecessary_parenthesissupport for property accesses and method invocations. - update
unnecessary_parenthesisto allow parentheses in more null-aware cascade contexts. - update
unreachable_from_mainto track static elements. - update
unnecessary_null_checksto not report on arguments passed toFuture.valueorCompleter.complete. - mark
always_use_package_importsandprefer_relative_importsas incompatible rules. - update
only_throw_errorsto not report onNever-typed expressions. - update
unnecessary_lambdasto not report withlate finalvariables. - update
avoid_function_literals_in_foreach_callsto not report with nullable- typed targets. - add new lint:
deprecated_member_use_from_same_packagewhich replaces the soft-deprecated analyzer hint of the same name. - update
public_member_api_docsto not require docs on enum constructors. - update
prefer_void_to_nullto not report on as-expressions.
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 rundart migrateusing Dart version 2.19, before upgrading to Dart version 3.0.Pub
-
To preserve compatibility with null-safe code pre Dart 3, Pub will interpret a language constraint indicating a language version of
2.12or higher and an upper bound of<3.0.0as<4.0.0.For example
>=2.19.2 <3.0.0will be interpreted as>=2.19.2 <4.0.0. -
dart pub publishwill no longer warn aboutdependency_overrides. Dependency overrides only take effect in the root package of a resolution. -
dart pub token addnow verifies that the given token is valid for including in a header according to RFC 6750 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. -
dart pub getand related commands will now by default also update the dependencies in theexamplefolder (if it exists). Use--no-exampleto avoid this. -
On Windows the
PUB_CACHEhas moved to%LOCALAPPDATA%, since Dart 2.8 thePUB_CACHEhas been created in%LOCALAPPDATA%when one wasn't present. Hence, this only affects users with aPUB_CACHEcreated by Dart 2.7 or earlier. If you havepath/to/.pub-cache/bininPATHyou may need to update yourPATH.
Release notes
Open source →- Breaking change: change type of
DartDebugAdapter.vmServicefromVmServiceInterfacetoVmService.
-
-
2.11.111 Oct 2023Release notes
Open source →- [DAP]
restartFrameRequestis now supported for frames up until the first async boundary (that are not also the top frame). - Update
vm_serviceversion to >=11.0.0 <13.0.0.
- [DAP]
-
2.9.520 Nov 2023Release notes
Open source →- [DAP] The change to use VM Service Isolate numbers for
threadIds has been reverted because Isolate numbers can be larger than the 32-bit integers allowed in DAP. - [DAP] Threads returned from
threadsRequestfrom the DDS DAP handler now includeisolateIdfields to allow mapping back to VM Service Isolates.
- [DAP] The change to use VM Service Isolate numbers for
-
2.9.401 Aug 2023 -
2.9.301 Aug 2023Release notes
Open source →This is a patch release that fixes DDC to handle a breaking change in Chrome (issue #43193).
Release notes
Open source →- [DAP]
threadIds generated by the debug adapter now match the Isolate numbers of the underlying isolates. - [DAP] Global evaluation (evaluation without a
frameId) is now available for top-levels if afile://URI for a script is provided as thecontextfor anevaluaterequest. - [DAP] Fix ConcurrentModificationError when sending breakpoints.
- [DAP]
-
2.9.206 Jul 2023Release notes
Open source →This is a patch release that fixes transient StackOverflow exceptions when building Flutter applications (issue flutter/flutter#63560).
Release notes
Open source →- [DAP] Fixed an issue that could cause breakpoints to become unresolved when there are multiple isolates (such as during a test run).
- [DAP] Fixed an issue where stack frames parsed in test failures could produce incorrect absolute paths in the
source.pathfield if the working directory of the debug adapter did not match that of the launch/attach request. - [DAP] A new configuration option
bool? allowAnsiColorOutputcan enable using ansi color codes inOutputevents to improve readability of stack traces (fading out frames that are not user code). - Increase minimum Dart SDK version to 3.0.0.
-
2.9.123 Jun 2023Release notes
Open source →This is a patch release that fixes unhandled exceptions in some Flutter applications (issue flutter/flutter#63038).
Release notes
Open source →- [DAP] A new configuration option
bool? showGettersInDebugViewsallows getters to be shown wrapped in Variables/Evaluation responses so that they can be lazily expanded by the user.evaluateGettersInDebugViewsmust befalsefor this behaviour. - [DAP]
runInTerminalrequests are now sent after first responding to thelaunchRequest. - [DAP] Skipped tests are now marked with
!instead of✓inOutputevents. - [DAP] Implemented
pauserequest. - [DAP] Fixed an issue that could leave breakpoints unresolved when adding/removing other breakpoints in a file.
- Fixed a bug that was preventing clients from receiving
IsolateReloadevents (see https://dartbug.com/49491). - Added notifications for DAP events.
- [DAP] A new configuration option
-
2.9.006 Jun 2023Release notes
Open source →Language
Core libraries
dart:async- Adds
Stream.multiconstructor creating streams which can be listened to more than once, and where each individual listener can be controlled independently.
dart:convert- Breaking change #41100: When encoding a string containing unpaired
surrogates as UTF-8, the unpaired surrogates will be encoded as replacement
characters (
U+FFFD). When decoding UTF-8, encoded surrogates will be treated as malformed input. When decoding UTF-8 withallowMalformed: true, the number of replacement characters emitted for malformed input sequences has been changed to match the WHATWG encoding standard.
dart:io- #42006: The signature of
exithas been changed to return theNevertype instead ofvoid. since no code will run after it, - Class
OSErrornow implementsException. This change meansOSErrorwill now be caught in catch clauses catchingExceptions. - Added
InternetAddress.tryParse. - Abstract Unix Domain Socket is supported on Linux/Android now. Using an
InternetAddresswithaddressstarting with '@' and type beingInternetAddressType.Unixwill 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.currentdoes not work with long path.
dart:html-
Breaking change:
CssClassSet.add()previously returnednullif theCssClassSetcorresponded to multiple elements. In order to align with the null-safe changes in theSetinterface, it will now returnfalseinstead. The same applies forCssClassSet.toggle. -
EventStreamSubscription.cancelmethod used to returnnull, but sinceStreamSubscription.cancelhas changed to be non-nullable, this method returns an emptyFutureinstead. Due to an optimization onnullFutures, this method used to complete synchronously, but now that theFutureis empty instead, it completes asynchronously, therefore potentially invalidating code that relied on the synchronous side-effect. This change will only affect code using sound null-safety. See issue #41653 for more details. -
Methods in
Consolehave been updated to better reflect the modern Console specification. Particularly of interest aredirandtablewhich take in extra optional arguments.
dart:mirrors-
Breaking change #42714: web compilers (dart2js and DDC) now produce a compile-time error if
dart:mirrorsis imported.Most projects should not be affected. Since 2.0.0 this library was unsupported and produced runtime errors on all its APIs. Since then several tools already reject code that use
dart:mirrorsincluding webdev and flutter tools, we expect few projects to run into this problem.
Tools
dartfmt
- Add
--fix-single-cascade-statements. - Correctly handle
varin--fix-function-typedefs. - Preserve leading indentation in fixed doc comments.
- Split outer nested control flow elements.
- Always place a blank line after script tags.
- Don't add unneeded splits on if elements near comments.
- Indent blocks in initializers of multiple-variable declarations.
- Update the null-aware subscript syntax from
?.[]to?[].
Analyzer
- Static analyses with a severity of "error" can no longer be ignored with
comments (
// ignore: codeand// ignore_for_file: code).
Linter
Updated the Linter to
0.1.117, which includes:- New lint:
do_not_use_environment. - New lint:
exhaustive_cases. - New lint:
no_default_cases(experimental). - New lint:
sized_box_for_whitespace. - New lint:
use_is_even_rather_than_modulo. - Updated
directives_orderingto remove third party package special-casing. - Updated
prefer_is_emptyto special-case assert initializers and const contexts. - Updated
prefer_mixinto allow "legacy" SDK abstract class mixins. - Updated
sized_box_for_whitespaceto address false-positives. - Updated
type_annotate_public_apisto allow inferred types in final field assignments. - Updated
unnecessary_lambdasto check for tear-off assignability. - Updated
unsafe_htmlto use aSecurityLintCode(making it un-ignorable) and to includeWindow.open,Element.htmlandDocumentFragment.htmlin unsafe API checks. Also added checks for attributes and methods on extensions.
Dart VM
- Breaking change #41100: When printing a string using the
printfunction, 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, theDart_StringToUTF8function in the Dart API will convert unpaired surrogates into replacement characters.
Pub
pub runandpub global runaccepts a--enable-experimentflag enabling experiments in the Dart VM (and language).- Warn when publishing the first null-safe version of a package.
pub outdated:- If the current version of a dependency is a prerelease version, use prereleases for latest if there is no newer stable.
- Don't require a
pubspec.lockfile. When the lockfile is missing, the Current column is empty.
pub upgrade: Show summary count of outdated packages after running. It will also only show newer packages if they are not prereleases or the package is already a prerelease.- Publishing Flutter plugins using the old plugin format is no longer allowed. Plugins using the old plugin format can still be consumed.
pub run: Fix precompilation with relativePUB_CACHEpaths (#2486).- Preserve Windows line endings in
pubspec.lockif they are already there (#2489). - Better terminal color-detection. Use colors in terminals on Windows.
- Fix git folder names in cache, allowing for ssh-style git dependencies.
- Fix: Avoid precompilation of dependencies of global packages.
- Adds
-
2.9.0+hotfix17 Jul 2023Nothing published for this version
-
2.8.302 Jun 2023Release notes
Open source →This is a patch release that fixes the following issues:
- crashes in Flutter apps (issue flutter/flutter#57318).
- a regression in stack traces (issue #41907).
- re-canonicalization of constants with unboxed fields (issue flutter/flutter#57190).
-
2.8.231 May 2023Release notes
Open source →This is a patch release that fixes an AOT compilation bug in global transformations which manifests as a NoSuchMethod exception (issue flutter/flutter#56479).
Release notes
Open source →- [DAP] Fixed an issue that could result in unhandled exceptions from in-flight requests when the application/VM Service is shutting down.
-
2.8.108 May 2023Release notes
Open source →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.
Language
There are no new language features in this release. There are only two minor breaking changes:
-
Breaking change #40675: Fixed an implementation bug where local variable inference would incorrectly use the promoted type of a type variable.
-
Breaking change #41362: Dart 2.0.0 made the clauses
implements Function,extends Function, orwith Functionhave no effect (spec section 19.6). We fixed an implementation bug that may be visible on some rare scenarios.
Core libraries
dart:async-
Breaking change #40676: Changed the return type of
StreamSubscription.cancel()toFuture<void>. Previously, it was declared to returnFutureand was allowed to returnnullat runtime. -
Breaking change #40681: The
runZoned()function is split into two functions:runZoned()andrunZonedGuarded(), where the latter has a requiredonErrorparameter, and the former has none. This prepares the functions for null safety where the two functions will differ in the nullability of their return types. -
Breaking change #40683: Errors passed to
Completer.completeError(),Stream.addError(),Future.error(), etc. can no longer benull. These operations now synchronously throw an exception if passed anullerror. -
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 anullvalue.Error handling functions need no longer be prepared for
nullstack traces.
dart:core-
Breaking change #40674: Three members on
RuneIteratorno longer returnnullwhen accessed before the first call tomoveNext(). Instead,currentandrawIndexreturn-1andcurrentAsStringreturns an empty string. -
Breaking change #40678: The
String.fromEnvironment()default value fordefaultValueis now an empty string instead ofnull. Likewise, the default value forint.fromEnvironment()'sdefaultValueparameter is zero. Under null safety, a constructor cannot returnnull, so this prepares these APIs for that. -
The class
CastErroris deprecated, and all implementation specific classes implementingTypeErrororCastErrornow implement both. In a future release,CastErrorwill be removed. See issue 40763 for details. -
Adds
StackTrace.emptyconstant which is the stack trace used as default stack trace when no better alternative is available. -
The class
TypeErrorno longer extendsAssertionError. This also means that it no longer inherits the spuriousmessagegetter which was added toAssertionErrorwhen the second operand toassertwas allowed. The value of that getter on aTypeErrorwas the same string as returned bytoString(), so it is still available. -
ArgumentError.checkNotNull()and theRangeErrorstatic methodscheckValueInInterval(),checkValidIndex()andcheckNotNegative()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.
dart:developer- The constructors for
TimelineTasknow accept an optionalfilterKeyparameter. If provided, the arguments for all events associated with the task will contain an entry namedfilterKey, set to the value of thefilterKeyparameter provided in the constructor. This will be used by tooling to allow for better filtering of timeline events.
dart:ffi-
Breaking change: Changed
Pointer.asFunction()andDynamicLibrary.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 ifdart:ffiis imported directly. This breaks code wheredart:ffiis not directly imported. To fix, add:import 'dart:ffi';
dart:html-
Breaking change #39627: Changed the return type of several HTML native methods involving futures. In return types that matched
Future<List<T>>,T waschanged todynamic. These methods would have resulted in a runtime error if they were used. -
Breaking change:
Node.insertAllBefore()erroneously had a return type ofNode, even though it was not returning anything. This has been corrected tovoid.
dart:io-
Class
HttpParserwill no longer throw an exception when a HTTP response status code is within [0, 999]. Customized status codes in this range are now valid. -
Breaking change #33501: The signature of
HttpHeadersmethodsadd()andsethave been changed to:void add(String name, Object value, {bool preserveHeaderCase: false}) void set(String name, Object value, {bool preserveHeaderCase: false})Setting
preserveHeaderCasetotruepreserves the case of thenameparameter instead of converting it to lowercase. TheHttpHeader.forEach()method provides the current case of each header.This is breaking only for classes extending or implementing
HttpHeadersand having their ownaddorsetmethods without thebool preserveHeaderCasenamed parameter. -
Breaking change #40702: The
Socketclass now throws aSocketExceptionif 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 returnnull. -
Breaking change #40483: The
Processclass now throws aStateErrorif the process is detached (ProcessStartMode.detachedandProcessStartMode.detachedWithStdio) upon accessing theexitCodegetter. It now also throws when not connected to the child process's stdio (ProcessStartMode.detachedandProcessStartMode.inheritStdio) upon accessing thestdin,stdout, andstderrgetters. Previously, these getters would all returnnull. -
Breaking change #40706: The dummy object returned if
FileStat.stat()orFileStat.statSync()fail now contains Unix epoch timestamps instead ofnullfor theaccessed,changed, andmodifiedgetters. -
Breaking change #40709: The
HeaderValueclass now parses more strictly in two invalid edge cases. This is the class used to parse the semicolon delimited parameters used in theAccept,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=").parametersnow gives{"a": ""}rather than{"a": null}.Invalid inputs with unbalanced double quotes are now rejected. E.g.
HeaderValue.parse('v;a="b').parameterswill now throw aHttpExceptioninstead of giving{"a": "b"}. -
The
HeaderValue.toString()method now supports parameters withnullvalues by omitting the value.HeaderValue("v", {"a": null, "b": "c"}).toString()now givesv; a; b=c. This behavior can be used to implement some features in theAcceptandSec-WebSocket-Extensionsheaders.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:
HeaderValue("v", {"a": "A", "b": "(B)", "c": "", "d": "ø", "e": "\\\""}).toString()Gives:
v;a=A;b="(B)";c="";d="ø";e="\\\"". -
Unix domain sockets are now supported on Linux, Android and MacOS, which can be used by passing a
InternetAddressofInternetAddressType.Unixinto theconnect(),startConnect()andbind()methods. Theportargument in those methods will be ignored. Theportgetter always returns 0 for Unix domain sockets. -
Class
InternetAddressTypegains one more optionUnix, which represents a Unix domain address. -
Class
InternetAddress:-
InternetAddressconstructor gains an optionaltypeparameter. To create a Unix domain address,typeis set toInternetAddressType.Unixandaddressis a file path. -
InternetAddressgains a new constructorfromRawAddress()that takes an address in byte format for Internet addresses or raw file path for Unix domain addresses.
-
-
Breaking change #40681: The static methods
runZoned()andrunWithHttpOverrides()onHttpOverridesno longer acceptzoneSpecificationandonErrorparameters. Use therunZoned()orrunZonedGuarded()functions fromdart:asyncdirectly if needing to specify those. -
Class
HttpClientandHttpServer, when receivingHttpRequestorHttpClientResponse, will now put a 8K size limit on its header fields and values.
dart:mirrors- Added
MirrorSystem.neverType.
Dart VM
-
Added
Dart_TypeDynamic,Dart_TypeVoidandDart_TypeNever. Typedynamiccan no longer by reached usingDart_GetType(dart:core, dynamic). -
Added the following methods to the VM embedding API:
Dart_GetNonNullableType()Dart_GetNullableType()Dart_TypeToNonNullable()Dart_TypeToNullable()Dart_IsLegacyType()Dart_IsNonNullableType()Dart_IsNullableType()
Tools
Dart Dev Compiler (DDC)
We fixed several inconsistencies between DDC and Dart2JS so that users less frequently encounter code that is accepted by one compiler but then fails in the other.
-
Breaking change: Deleted the legacy (analyzer based) version of DDC. For additional details see the announcement.
-
The
--kerneloption is now ignored and defaults to true. There is no longer any way to invoke the legacy (analyzer based) version of DDC. -
Command line arguments that were only used for the legacy DDC have been removed.
-
The pre-compiled
dart_sdk.jsartifacts generated by legacy DDC have been deleted fromdart-sdk/lib/dev_compilerin favor of the versions located atdart-sdk/lib/dev_compiler/kernel.
-
-
Breaking change: Functions passed to JavaScript using the recommended
package:jsinterop specification must now be wrapped with a call toallowInterop. This behavior was always enforced by Dart2JS, but was not enforced consistently by DDC. It is now enforced by both. -
Breaking change: Constructors in
@JS()classes must be marked withexternal. Previously theexternalcould be omitted in some cases with DDC but doing so would cause incorrect behavior with Dart2JS. -
JS interop classes with an index operator are now static errors.
-
All remaining support from the
dart:mirrorslibrary has been removed. Use of this library on the web has been unsupported and prevented by the Dart build systems since Dart v2.0.0. All known exception cases have been cleaned up. This change makes DDC and Dart2JS now behave consistently.The library can still be imported on web apps, but all APIs throw. In a future breaking change release, imports to this library will likely become a compile-time error.
Dart2JS
A new representation of runtime types is enabled by default.
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 to the compiler. This makes it possible to do certain kind of optimizations on 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:
-
Types are now canonicalized, this fixes a long standing bug that Types could not be used in switch cases (issue 17207).
-
Code-size changes may be visible, but the difference is small overall. It is more visible on smaller apps because the new implementation includes more helper methods. On large apps we have even seen an overall code-size reduction.
-
Certain checks are a lot faster. This is less noticeable if you are compiling apps with
-O3where checks are omitted altogether. Even with-O3, the performance of someischecks used by your app may improve. -
When using
-O3and-O4incorrect type annotations could surface as errors. The old type representation was accidentally lenient on some invalid type annotations. We have only encountered this issue on programs that were not tested properly at the js-interop program boundary. -
Type.toString()has a small change that is rarely visible. For a long time, Dart2JS has had support to erase unused type variables. Today, when Dart2JS is given--lax-runtime-type-to-string(currently included in-O2,-O3, and-O4) and it decides to erase the type variable of a classFoo<T>, then it compiles expressions likefoo.runtimeType.toString()to printFoo. With the new representation, this will showFoo<erased>instead. This change may be visible in error messages produced by type checks involving erased types.
Because types and classes are represented separately, we will likely reevaluate restrictions of deferred libraries in the near future. For example, we could 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
--use-old-rtito Dart2JS if necessary, but our goal is to delete the old type representation soon.In addition, we fixed some inconsistencies between Dart2JS and DDC:
-
JS interop classes with an index operator are now static errors instead of causing invalid code in Dart2JS.
-
Breaking change: The subtyping rule for generic functions is now more forgiving. Corresponding type parameter bounds now only need to be mutual subtypes rather than structurally equal up to renaming of bound type variables and equating all top types.
-
Breaking change: Types are now normalized. See normalization for the full specification. Types will now be printed in their normal form, and mutual subtypes with the same normal form will now be considered equal.
-
Breaking change: Constructors in
@JS()classes must be marked withexternal. Previously, the external could be omitted for unused constructors. Omittingexternalfor a constructor which is used would cause incorrect behavior at runtime, now omitting it on any constructor is a static error.
Other dart2js changes:
- Breaking change: The
--package-rootflag, which was hidden and disabled in Dart 2.0.0, has been completely removed. Passing this flag will now causedart2jsto fail.
Linter
Updated the Linter to
0.1.114, which includes:- Fixed
avoid_shadowing_type_parametersto support extensions and mixins. - Updated
non_constant_identifier_namesto allow named constructors made up of only underscores (_). - Updated
avoid_unused_constructor_parametersto ignore unused params named in all underscores (_).
Analyzer
- Removed support for the deprecated analysis options file name
.analysis_options.
Pub
-
Added
pub outdatedcommand which lists outdated package dependencies, and gives advice on how to upgrade. -
pub getandpub upgradenow fetch version information about hosted dependencies in parallel, improving the time package resolution performance. -
pub getandpub upgradeno longer precompile executables from dependencies by default. Instead they are precompiled on firstpub run. Usepub get --precompileto get the previous behavior. -
Fixed missing retries of DNS failures during
pub get. -
If code contains imports for packages not listed in the package's
pubspec.yamlthenpub publishwill reject the package. -
pub publishno longer requires the presence of ahomepagefield, if therepositoryfield is provided. -
pub publishwarns if non-pre-release packages depends on pre-release packages or pre-release Dart SDKs. -
Relative paths in
pubspec.locknow use/also on Windows to make the file sharable between machines. -
Fixed language version in
.dart_tool/package_config.jsonfor packages without an explicit SDK constraint. Pub now writes an empty language version where before the language version of the current SDK would be used. -
%LOCALAPPDATA%is now preferred over%APPDATA%when creating a pub cache directory on Windows.%LOCALAPPDATA%is not copied when users roam between devices. -
pub publishwarns if LICENSE and README.md files are not called those exact names. -
pub repair cachedownloads hosted packages in parallel.
Release notes
Open source →- Updated DDS protocol version to 1.5.
- Added
getPerfettoVMTimelineWithCpuSamplesRPC. - Updated
vm_serviceversion to >=11.0.0 <12.0.0.
-
-
2.8.004 May 2023 withdrawnNothing published for this version
-
2.7.1001 May 2023Release notes
Open source →- [DAP] Isolates that exit immediately after being paused (perhaps by another debugger or due to the app shutting down) will no longer cause a crash.
-
2.7.920 Apr 2023Release notes
Open source →- [DAP] Configuring and resuming isolates will no longer cause a crash if the isolate exits before the request is processed.
-
2.7.803 Apr 2023Release notes
Open source →- [DAP] Sentinel values (such as uninitialized fields/locals) will no longer cause
scopesRequest/variablesRequestto fail, instead showing appropriate text (like "<not initialized>") against the variable.
- [DAP] Sentinel values (such as uninitialized fields/locals) will no longer cause
-
2.7.730 Mar 2023Release notes
Open source →- [DAP] Debug adapters now only call
setLibraryDebuggablewhen the debuggable flag changes from the default/current values, reducing the amount of VM Service traffic for new isolates/reloads. - [DAP]
breakpointevents are no longer sometimes sent prior to the response to thesetBreakpointsRequestthat created them.
- [DAP] Debug adapters now only call
-
2.7.601 Mar 2023Release notes
Open source →- [DAP]
scopesRequestnow returns aGlobalsscope containing global variables for the current frame. - [DAP] Responses to
setBreakpointsRequestwill now haveverified: falseand will sendbreakpointevents to updateverifiedand/orline/columnas the VM resolves them.
- [DAP]
-
2.7.513 Feb 2023 -
2.7.430 Jan 2023Release notes
Open source →- [DAP] Added support for
,d(decimal),,h(hex) and,nq(no quotes) format specifiers to be used as suffixes to evaluation requests. - [DAP] Added support for
format.hexinvariablesRequestandevaluateRequest.
- [DAP] Added support for
-
2.7.327 Jan 2023Release notes
Open source →- [DAP] Added support for displaying records in responses to
variablesRequest. - A new exception
ExistingDartDevelopmentServiceException(extendingDartDevelopmentServiceException) is thrown when trying to connect DDS to a VM Service that already has a DDS instance. This new exception contains addsUrifield that is populated with the URI of the existing DDS instance if provided by the target VM Service.
- [DAP] Added support for displaying records in responses to
-
2.7.216 Jan 2023Release notes
Open source →Security advisory: This is a patch release that addresses a vulnerability in
dart:htmlNodeValidator related to DOM clobbering ofpreviousSibling. See the security advisory CVE-2020-8923 for more details. Thanks to Vincenzo di Cicco for finding and reporting this issue.This release also improves compatibility with ARMv8 processors (issue 40001) and dart:io stability (issue 40589).
Release notes
Open source →- Update DDS protocol version to 1.4.
- [DAP] Forward any events from the VM Service's
ToolEventstream asdart.toolEventDAP events.
-
2.7.112 Jan 2023Release notes
Open source →This is a patch release that improves dart2js compile-time (issue 40217).
Breaking change: The Dart SDK for macOS is now only available for x64 (issue 39810).
Release notes
Open source →- Updated
vm_serviceversion to >=9.0.0 <11.0.0. - Simplified the DevTools URI composed by DDS.
- Fix issue where DDS was invoking an unimplemented RPC against a non-VM target.
- Updated
-
2.7.010 Jan 2023Release notes
Open source →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
Language
-
Breaking change: Static extension members are accessible when imported with a prefix (issue 671). In the extension method preview launch, importing a library with a prefix hid all extension members in addition to hiding the extension name, thereby making them inaccessible in the importing library except via the explicit override syntax. Based on user feedback, we have changed this to make extensions methods accessible even when imported with a prefix.
```dart // "thing.dart" class Thing { } 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 } ```
Core libraries
dart:io- Breaking change: Added
IOOverrides.serverSocketBindto aid in writing tests that wish to mockServerSocket.bind.
dart:typed_data- Added new constructors,
.sublistView(TypedData, [start, end])to allTypedDataclasses. The constructor makes it easier, and less error-prone, to create a view of (a slice of) anotherTypedDataobject.
Dart VM
- New fields added to existing instances by a reload will now be initialized lazily, as if the field was a late field. This makes the initialization order program-defined, whereas previously it was undefined.
Tools
Linter
The Linter was updated to
0.1.104, which includes:- updated
unnecessary_overridesto allow overrides when annotations (besides@overrideare specified) - updated
file_namesto allow names w/ leading_'s (and improved performance) - new lint:
unnecessary_final
Pub
-
pub getgenerates.dart_tool/package_config.jsonin addition to.packagesto support language versioning. -
pub publishnow warns about the old flutter plugin registration format. -
pub publishnow warns about theauthorfield in pubspec.yaml being. obsolete. -
Show a proper error message when
gitis not installed.
Release notes
Open source →- Added
DartDevelopmentService.setExternalDevToolsUri(Uri uri), adding support for registering an external DevTools server with DDS.
-
-
2.6.019 Dec 2022Release notes
Open source →Language
-
[IN PREVIEW] Static extension members: A new language feature allowing specially declared static functions to be invoked like instance members on expressions of appropriate static types is available in preview.
Static extension members are declared using a new
extensiondeclaration. Example: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])]; }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 byintListmatching theList<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.Extensions can be declared on any type, not just interface types.
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; } } 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); } -
Breaking change #37985: Inference is changed when using
Nullvalues in aFutureOrcontext. Namely, constraints of the forms similar toNull<:FutureOr<T>now yieldNullas the solution forT. For example, the following code will now print "Null", and it was printing "dynamic" before (note that the anonymous closure() {}in the example hasNullas its return type):import 'dart:async'; void foo<T>(FutureOr<T> Function() f) { print(T); } main() { foo(() {}); }
Core libraries
- Default values of parameters of abstract methods are no longer available via
dart:mirrors.
dart:developer- Added optional
parentparameter toTimelineTaskconstructor to allow for linking of asynchronous timeline events in the DevTools timeline view.
dart:ffi- Breaking change: The API now makes use of static extension members. Static
extension members enable the
dart:ffiAPI to be more precise with types, and provide convenient access to memory through extension getters and setters. The extension members onPointerprovide.valueand.value =for accessing the value in native memory and[]and[]=for indexed access. The methodasExternalTypedDatahas been replaced withasTypedListextension methods. And finally,Structsdo no longer have a type argument and are accessed using the extension member.refonPointer. These changes makes the code usingdart:ffimuch more concise. - Breaking change: The memory management has been removed
(
Pointer.allocateandPointer.free). Instead, memory management is available in package:ffi. - Breaking change:
Pointer.offsetBywas removed, usecastandelementAtinstead. - Faster memory load and stores.
- The dartanalyzer (commandline and IDEs) now reports
dart:ffistatic errors. - Callbacks are now supported in AOT (ahead-of-time) compiled code.
dart:io- Added
enableTimelineLoggingproperty toHttpClientwhich, when enabled, will post HTTP connection and request information to the developer timeline for allHttpClientinstances.
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.
Dart for the Web
Dart Dev Compiler (DDC)
- Kernel DDC will no longer accept non-dill files as summary inputs.
- Removed support for the deprecated web extension.
Tools
Linter
The Linter was updated to
0.1.101, which includes:- fixed
diagnostic_describe_all_propertiesto flag properties inDiagnosticables with no debug methods defined - fixed
noSuchMethodexception incamel_case_extensionswhen analyzing unnamed extensions - fixed
avoid_printto catch tear-off usage - new lint:
avoid_web_libraries_in_flutter(experimental) - (internal) prepare
unnecessary_lambdasfor comingMethodInvocationvs.FunctionExpressionInvocationchanges
Release notes
Open source →- Add support for registering and subscribing to custom service streams.
- [DAP] Supplying incorrect types of arguments in
launch/attachrequests will now result in a clear error message in an error response instead of terminating the adapter.
-
-
2.5.031 Oct 2022Release notes
Open source →Language
The set of operations allowed in constant expressions has been expanded as described in the constant update proposal. The control flow and spread collection features shipped in Dart 2.3 are now also supported in constants as described in the specification here.
Specifically, it is now valid to use the following operations in constant expressions under the appropriate conditions:
- Casts (
e as T) and type tests (e is T). - Comparisons to
null, even for types which override the==operator. - The
&,|, and^binary operators on booleans. - The spread operators (
...and...?). - An
ifelement in a collection literal.
// Example: these are now valid constants. const Object i = 3; 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:
- 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.
// Example: x is now a valid constant definition. const String s = null; const int x = (s == null) ? 0 : s.length;Core libraries
-
Breaking change #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 ofUint8List:BytesBuilder.takeBytes()BytesBuilder.toBytes()Datagram.dataFile.readAsBytes()(Future<Uint8List>)File.readAsBytesSync()InternetAddress.rawAddressRandomAccessFile.read()(Future<Uint8List>)RandomAccessFile.readSync()RawSocket.read()Utf8Codec.encode()(andUtf8Encoder.convert())
In addition, the following classes were updated to implement
Stream<Uint8List>rather thanStream<List<int>>:HttpRequestSocket
Possible errors and how to fix them
-
The argument type 'Utf8Decoder' can't be assigned to the parameter type 'StreamTransformer<Uint8List, dynamic>'
type 'Utf8Decoder' is not a subtype of type 'StreamTransformer' of 'streamTransformer'"
You can fix these call sites by updating your code to use
StreamTransformer.bind()instead ofStream.transform(), like so:Before:
stream.transform(utf8.decoder)After:utf8.decoder.bind(stream) -
The argument type 'IOSink' can't be assigned to the parameter type 'StreamConsumer<Uint8List>'
type '_IOSinkImpl' is not a subtype of type 'StreamConsumer<Uint8List>' of 'streamConsumer'
You can fix these call sites by casting your stream instance to a
Stream<List<int>>before calling.pipe()on the stream, like so:Before:
stream.pipe(consumer)After:stream.cast<List<int>>().pipe(consumer)
Finally, the following typed lists were updated to have their
sublist()methods declare a return type that is the same as the source list:Int8List.sublist()→Int8ListInt16List.sublist()→Int16ListInt32List.sublist()→Int32ListInt64List.sublist()→Int64ListInt32x4List.sublist()→Int32x4ListFloat32List.sublist()→Float32ListFloat64List.sublist()→Float64ListFloat32x4List.sublist()→Float32x4ListFloat64x2List.sublist()→Float64x2ListUint8List.sublist()→Uint8ListUint8ClampedList.sublist()→Uint8ClampedListUint16List.sublist()→Uint16ListUint32List.sublist()→Uint32ListUint64List.sublist()→Uint64List
dart:async- Add
valueanderrorconstructors onStreamto allow easily creating single-value or single-error streams.
dart:core-
Update
Uriclass to support RFC6874: "%25" or "%" can be appended to the end of a valid IPv6 representing a Zone Identifier. A valid zone ID consists of unreversed character or Percent encoded octet, which was defined in RFC3986. IPv6addrz = IPv6address "%25" ZoneID
dart:io-
Breaking change #37192: The
Cookieclass's constructor'snameandvalueoptional positional parameters are now mandatory. The signature changes from:Cookie([String name, String value])to
Cookie(String name, String value)However, it has not been possible to set
nameandvalueto 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. -
Breaking change #37192: The
Cookieclass'snameandvaluesetters now validates that the strings are made from the allowed character set and are not null. The constructor already made these checks and this fixes the loophole where the setters didn't also validate.
Dart VM
Tools
Pub
- Clean-up invalid git repositories in cache when fetching from git.
- Breaking change #36765: Packages published to pub.dev can no longer contain git dependencies. These packages will be rejected by the server.
Linter
The Linter was updated to
0.1.96, which includes:- fixed false positives in
unnecessary_parens - various changes to migrate to preferred analyzer APIs
- rule test fixes
Dartdoc
Dartdoc was updated to
0.28.4; this version includes several fixes and is based on a newer version of the analyzer package.Release notes
Open source →- [DAP]
variablesrequests now treat lists fromdart:typed_data(such asUint8List) like standardListinstances and return their elements instead of class fields. - [DAP]
variablesrequests now return information about the number of items in lists to allow the client to page through them. - [DAP]
terminatedevents are now always sent when detaching whether or not the debuggee terminates after unpause. - [DAP] Debug adapters can now add/overwrite
orgDartlangSdkMappingsto control mappings oforg-dartlang-sdk:///paths.
- Casts (
-
2.4.026 Sep 2022Release notes
Open source →Core libraries
dart:isolate-
TransferableTypedDataclass was added to facilitate faster cross-isolate communication ofUint8Listdata. -
Breaking change:
Isolate.resolvePackageUriwill always throw anUnsupportedErrorwhen compiled with dart2js or DDC. This was the only remaining API indart:isolatethat didn't automatically throw since we dropped support for this library in Dart 2.0.0. Note that the API already throws in dart2js if the API is used directly without manually setting up adefaultPackagesBasehook.
dart:developer- Exposed
result,errorCodeanderrorDetailgetters inServiceExtensionResponseto allow for better debugging of VM service extension RPC results.
dart:io-
Fixed
Cookieclass interoperability with certain websites by allowing the cookie values to be the empty string (Issue 35804) and not stripping double quotes from the value (Issue 33327) in accordance with RFC 6265. -
#36971: The
HttpClientResponseinterface has been extended with the addition of a newcompressionStategetter, which specifies whether the body of a response was compressed when it was received and whether it has been automatically uncompressed viaHttpClient.autoUncompress.As part of this change, a corresponding new enum was added to
dart:io:HttpClientResponseCompressionState.This is a breaking change for those implementing the
HttpClientResponseinterface as subclasses will need to implement the new getter.
dart:async- Breaking change #36382:
The
await forallowednullas a stream due to a bug inStreamIteratorclass. This bug has now been fixed.
dart:core-
#36171: The
RegExpinterface has been extended with two new constructor named parameters:unicode:(bool, default:false), for Unicode patternsdotAll:(bool, default:false), to change the matching behavior of '.' to also match line terminating characters.
Appropriate properties for these named parameters have also been added so their use can be detected after construction.
In addition,
RegExpmethods that originally returnedMatchobjects now return a more specific subtype,RegExpMatch, which adds two features:Iterable<String> groupNames, a property that contains the names of all named capture groupsString namedGroup(String name), a method that retrieves the match for the given named capture group
This is a breaking change for implementers of the
RegExpinterface. Subclasses will need to add the new properties and may have to update the return types on overridden methods.
Language
- Breaking change #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:
class A<X> {}; class B<X> extends A<void Function(X)> {};- The identifier
asynccan now be used in asynchronous and generator functions.
Dart for the Web
Dart Dev Compiler (DDC)
- Improve
NoSuchMethoderrors for failing dynamic calls. Now they include specific information about the nature of the error such as:- Attempting to call a null value.
- Calling an object instance with a null
call()method. - Passing too few or too many arguments.
- Passing incorrect named arguments.
- Passing too few or too many type arguments.
- Passing type arguments to a non-generic method.
Tools
Linter
The Linter was updated to
0.1.91, which includes the following changes:- Fixed missed cases in
prefer_const_constructors - Fixed
prefer_initializing_formalsto no longer suggest API breaking changes - Updated
omit_local_variable_typesto allow explicitdynamics - Fixed null-reference in
unrelated_type_equality_checks - New lint:
unsafe_html - Broadened
prefer_null_aware_operatorsto work beyond local variables. - Added
prefer_if_null_operators. - Fixed
prefer_containsfalse positives. - Fixed
unnecessary_parenthesisfalse positives. - Fixed
prefer_asserts_in_initializer_listsfalse positives - Fixed
curly_braces_in_flow_control_structuresto handle more cases - New lint:
prefer_double_quotes - New lint:
sort_child_properties_last - Fixed
type_annotate_public_apisfalse positive forstatic constinitializers
Pub
pub publishwill no longer warn about missing dependencies for import statements inexample/.- OAuth2 authentication will explicitly ask for the
openidscope.
Release notes
Open source →- [DAP] Added support for sending progress notifications via
DartDebugAdapter.startProgressNotification. Standard progress events are sent when a clients setssupportsProgressReporting: truein its capabilities, unlesssendCustomProgressEvents: trueis included in launch configuration, in which case prefixed (dart.) custom notifications will be sent instead.
-
-
2.3.120 Sep 2022Release notes
Open source →This is a patch version release with bug fixes.
Tools
dart2js
- Fixed a bug that caused the compiler to crash when it compiled UI-as-code features within fields (Issue 36864).
Release notes
Open source →- Fixed issue where DDS wasn't correctly handling
Sentinelresponses inIsolateManager.initialize().
-
2.3.015 Sep 2022Release notes
Open source →The focus in this release is on the new "UI-as-code" language features which make collections more expressive and declarative.
Language
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. 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.
Spread
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:CupertinoPageScaffold( child: ListView(children: [ Tab2Header() ]..addAll(buildTab2Conversation()) ..add(buildFooter())), );Now you can write this:
CupertinoPageScaffold( child: ListView(children: [ Tab2Header(), ...buildTab2Conversation(), buildFooter() ]), );If you know the expression might evaluate to null and you want to treat that as equivalent to zero elements, you can use the null-aware spread
...?.Collection if
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: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); }We now allow
ifinside collection literals to conditionally omit or (withelse) swap out an element:Widget build(BuildContext context) { return Row( children: [ IconButton(icon: Icon(Icons.menu)), Expanded(child: title), if (isAndroid) IconButton(icon: Icon(Icons.search)), ], ); }Unlike the existing
?:operator, a collectionifcan be composed with spreads to conditionally include or omit multiple items:Widget build(BuildContext context) { return Row( children: [ IconButton(icon: Icon(Icons.menu)), if (isAndroid) ...[ Expanded(child: title), IconButton(icon: Icon(Icons.search)), ] ], ); }Collection for
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.
To solve this problem, you can use
forinside a collection literal. Each iteration of the loop produces an element which is then inserted in the resulting collection. Consider the following code:var command = [ engineDartPath, frontendServer, ...fileSystemRoots.map((root) => "--filesystem-root=$root"), ...entryPoints .where((entryPoint) => fileExists("lib/$entryPoint.json")) .map((entryPoint) => "lib/$entryPoint"), mainPath ];With a collection
for, the code becomes simpler: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 ];As you can see, all three of these features can be freely composed. For full details of the changes, see the official proposal.
Note: These features are not currently supported in const collection literals. In a future release, we intend to relax this restriction and allow spread and collection
ifinside const collections.Core library changes
dart:isolate- Added
debugNameproperty toIsolate. - Added
debugNameoptional parameter toIsolate.spawnandIsolate.spawnUri.
dart:core- RegExp patterns can now use lookbehind assertions.
- RegExp patterns can now use named capture groups and named backreferences. Currently, named group matches can only be retrieved in Dart either by the implicit index of the named group or by downcasting the returned Match object to the type RegExpMatch. The RegExpMatch interface contains methods for retrieving the available group names and retrieving a match by group name.
Dart VM
-
The VM service now requires an authentication code by default. This behavior can be disabled by providing the
--disable-service-auth-codesflag. -
Support for deprecated flags '-c' and '--checked' has been removed.
Dart for the Web
dart2js
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.
To use the binary format today, use
--dump-info=binary, instead of--dump-info.What to expect next?
-
The visualizer tool will not be updated to support the new binary format, but you can find several command-line tools at
package:dart2js_infothat provide similar features to those in the visualizer. -
The command-line tools in
package:dart2js_infoalso work with the old JSON format, so you can start using them even before you enable the new format. -
In a future release
--dump-infowill default to--dump-info=binary. At that point, there will be an option to fallback to the JSON format, but the visualizer tool will be deprecated. -
A release after that, the JSON format will no longer be available from dart2js, but may be available from a command-line tool in
package:dart2js_info.
Tools
dartfmt
- Tweak set literal formatting to follow other collection literals.
- Add support for "UI as code" features.
- Properly format trailing commas in assertions.
- Improve indentation of adjacent strings in argument lists.
Linter
The Linter was updated to
0.1.86, which includes the following changes:- Added the following lints:
prefer_inlined_adds,prefer_for_elements_to_map_fromIterable,prefer_if_elements_to_conditional_expressions,diagnostic_describe_all_properties. - Updated
file_namesto skip prefixed-extension Dart files (.css.dart,.g.dart, etc.). - Fixed false positives in
unnecessary_parenthesis.
Pub
- Added a CHANGELOG validator that complains if you
pub publishwithout mentioning the current version. - Removed validation of library names when doing
pub publish. - Added support for
pub global activateing package from a custom pub URL. - Added subcommand:
pub logout. Logs you out of the current session.
Dart native
Initial support for compiling Dart apps to native machine code has been added. Two new tools have been added to the
binfolder of the Dart SDK:-
dart2aot: AOT (ahead-of-time) compiles a Dart program to native machine code. The tool is supported on Windows, macOS, and Linux. -
dartaotruntime: A small runtime used for executing an AOT compiled program.
Release notes
Open source →- [DAP] Removed an unused parameter
resumeIfStartingfromDartDebugAdapter.connectDebugger. - [DAP] Fixed some issues where removing breakpoints could fail if an isolate exited during an update or multiple client breakpoints mapped to the same VM breakpoint.
- [DAP] Paths provided to DAP now always have Windows drive letters normalized to uppercase to avoid some issues where paths may be treated case sensitively.
- Fixed issue where DDS wasn't correctly handling
Sentinelresponses inIsolateManager.initialize().
- Added