NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
pub.dev · #112 most downloaded on pub.dev
A library used to spawn the Dart Developer Service, used to communicate with a Dart VM Service instance.
Last release 2 months ago
16 Jul 2026
Release timing varies
gaps range from 2 weeks to 7 months
Nearly every release is documented
notes for 58 of the last 60 stable releases
3 versions withdrawn
withdrawn after publishing
6 years old
105 releases · first in 2020
One column per quarter.
[DAP] Print truncated text from dart:developer's log() if the full string has been collected.
dart:developer's log() if the full string has been collected.Add --app-name option to dart development-service. This is a short, user focused name to describe the application being debugged.
--app-name option to dart development-service. This is a short, user
focused name to describe the application being debugged.Breaking change: [DAP] Support for the custom supportsDartUris client capability and dart-macro+file:/// mappings that supported the Dart macros exper…
Stopped(reason: 'entry') events will no longer be lost if an isolate has not yet reached the PauseStart state when connecting to the VM.supportsDartUris client capability and dart-macro+file:/// mappings that supported the Dart macros experiment have been removed.evaluateName will now be correctly set on child variables of variables in the Globals scope.solo no longer produce output events, reducing noisy output when running individual tests. The dart.testNotification events themselves are still forwarded.Deprecate getAvailableCachedCpuSamples and getCachedCpuSamples RPCs.
getAvailableCachedCpuSamples and getCachedCpuSamples RPCs.cachedUserTags parameter of DartDevelopmentService.startDartDevelopmentService.DartDevelopmentService.cachedUserTags getter.[DAP] Breakpoints are now added/removed individually instead of all being cleared and re-added during a setBreakpoints request. This improves performa
setBreakpoints request. This improves performance and can avoid breakpoints flickering between unresolved/resolved when adding new breakpoints in the same file.[DAP] Handle some additional errors if the VM Service is shutting down during an attempt to resume an isolate.
OutputEventss.evaluateRequest that are lists now include indexedVariables to allow for client-side paging.[DAP] Handle possible race condition when interacting with web applications that can cause an RPCError to be thrown if the application's isolate is di
RPCError to be thrown if the application's isolate is
disposed mid-RPC.Widen the dependency on package:shelf_web_socket.
package:shelf_web_socket.getStreamHistory RPC.This means the enableDds and enableAuthCodes arguments to the DartDebugAdapter base class have been deprecated and have any effect. Suppressing DDS (o…
Flutter). This means the enableDds and enableAuthCodes arguments to the DartDebugAdapter base class have been deprecated and have any effect. Suppressing DDS (or auth codes) should be done in launch configuration (for example using vmAdditionalArgs or toolArgs depending on the target tool).devtools_shared dependency to version ^11.0.0.runDartDevelopmentServiceFromCLI pass the specified bind address
directly into startDartDevelopmentService without resolving the address.vm_service constraint to >=14.3.0 <16.0.0.dap constraint to ^1.4.0.supportsANSIStyling to true in debug adapter capabilities to indicate that Output events might contain ansi color codes.OutputEventss.package:shelf_web_socket version 3.x.Added a new constant RpcErrorCodes.kConnectionDisposed = -32010 for requests failing because the service connection was closed. This value is not curr
RpcErrorCodes.kConnectionDisposed = -32010 for 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.google3WorkspaceRoot parameter to DartDevelopmentServiceLauncher.start
from Uri? to Object?. This parameter will eventually be changed to String?, but will
allow both Uri? and String? values for now.[DAP] Fixed an issue where "Service connection disposed" errors may go unhandled during termination/shutdown.
google3WorkspaceRoot parameter to DartDevelopmentServiceLauncher.start.Fixed DevTools URI not including a trailing '/' before the query parameters, which could prevent DevTools from loading properly.
format.hex in variablesRequest would not apply to values from lists such as Uint8List from dart:typed_data.package:dds/dds_launcher.dart, a library which can be used to launch DDS instances using dart development-service.Fix issue where DartDevelopmentServiceException.fromJson would throw a StateError whenever called, except when called to create an ExistingDartDevelop
DartDevelopmentServiceException.fromJson would throw a StateError whenever called, except when called to create an ExistingDartDevelopmentServiceException.Nothing published for this version
Added missing type to Event in postEvent.
Event in postEvent.variables responses.bin/dds.dart now closes the stderr pipe after writing its JSON to the stream.Nothing published for this version
Added missing await of WebSocketChannel.ready in startDartDevelopmentService.
WebSocketChannel.ready in startDartDevelopmentService.[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
console OutputEvent and the adapter will shut down gracefully.[DAP]: Fixed an issue where breakpoint changed events might contain incorrect location information when new isolates are created, causing breakpoints
changed events might contain incorrect location information when new isolates are created, causing breakpoints to appear to move in the editor.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").variables responses. This prevents entire map/list requests from failing when only some values inside are sentinels.requirePermissionToResume and requireUserPermissionToResume for onPauseStart and onPauseExit so that DDS waits for DAP's permission before resuming the isolate.The [parseStackFrames] parameter for sendOutput is ignored and deprecated.
OutputEvents are now scanned for stack frames to attach source metadata to. The [parseStackFrames] parameter for sendOutput is ignored and deprecated.Internal change: removed static method DevToolsUtils.initializeAnalytics and prepared DDS for using unified_analytics through the Dart Tooling Daemon.
DevToolsUtils.initializeAnalytics
and prepared DDS for using unified_analytics through the Dart Tooling Daemon.analytics parameter from the DevTools server defaultHandler method.README.md and added contributing guide (CONTRIBUTING.md).package:dds_service_extensions constraint to ^2.0.0.requireUserPermissionToResume values from the pause_isolates_on_start and pause_isolates_on_exit flags.package:web_socket_channel 2.x and 3.xpackage:shelf_web_socket 1.x and 2.xdevtools_shared dependency to version ^9.0.1.package:unified_analytics dependency.Breaking change: resume is now treated as a user-initiated resume request and force resumes paused isolates, regardless of required resume approvals.…
readyToResume and requireUserPermissionToResume RPCs.resume is 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 the readyToResume RPC to indicate to DDS that they are ready to resume.Breaking Change [#54640][]: The pattern context type schema for cast patterns has been changed from Object? to _ (the unknown type), to align with the…
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.
dart:asyncParallelWaitError to get some meta-information that
it can expose in its toString, and the Iterable<Future>.wait and
(Future,...,Future).wait extension methods now provide that information.
Should make a ParallelWaitError easier to log.dart:cliwaitFor is removed in 3.4.dart:ffiStruct.create and Union.create to create struct and union views
of the sequence of bytes stored in a subtype of TypedData.dart:ioBreaking change #53863: Stdout has a new field lineTerminator,
which allows developers to control the line ending used by stdout and
stderr. Classes that implement Stdout must define the lineTerminator
field. The default semantics of stdout and stderr are not changed.
Deprecates FileSystemDeleteEvent.isDirectory, which always returns
false.
dart:js_interopFixes an issue with several comparison operators in JSAnyOperatorExtension
that were declared to return JSBoolean but really returned bool. This led
to runtime errors when trying to use the return values. The implementation now
returns a JSBoolean to align with the interface. See issue #55024 for
more details.
Added ExternalDartReference and related conversion functions
toExternalReference and toDartObject. This is a faster alternative to
JSBoxedDartObject, but with fewer safety guarantees and fewer
interoperability capabilities. See #55187 for more details.
On dart2wasm, JSBoxedDartObject now 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 isA helper to make type checks easier with interop types. See
#54138 for more details.
dart:typed_dataBREAKING 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.
Improved code completion. Fixed over 50% of completion correctness bugs,
tagged analyzer-completion-correctness in the issue
tracker.
Support for new annotations introduced in version 1.14.0 of the meta package.
Support for the @doNotSubmit annotation, noting that any usage of an
annotated member should not be submitted to source control.
Support for the @mustBeConst annotation, which indicates that an
annotated parameter only accepts constant arguments.
unnecessary_library_name lint.missing_code_block_language_in_doc_comment lint."" for all dart.library.foo strings, where dart:foo is not an
available library. Instead there will only be entries for the available
libraries, like dart.library.core, where the value was, and still is,
"true". This should have no effect on const bool.fromEnvironment(...) or
const String.fromEnvironment(...) without a defaultValue argument, an
argument which was always ignored previously. It changes the behavior of
const bool.hasEnvironment(...) on such an input, away from always being
true and therefore useless.Dependency resolution and dart pub outdated will now surface if a dependency
is affected by a security advisory, unless the advisory is listed under a
ignored_advisories section in the pubspec.yaml file. To learn more about
pub's support for security advisories, visit
dart.dev/go/pub-security-advisories.
path-dependencies inside git-dependencies are now resolved relative to the
git repo.
All dart pub commands can now be run from any subdirectory of a project. Pub
will find the first parent directory with a pubspec.yaml and operate
relative it.
New command dart pub unpack that 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 VM flags and options can now be provided to any executable generated
using dart compile exe via the DART_VM_OPTIONS environment variable.
DART_VM_OPTIONS should 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_OPTIONS environment variable:
DART_VM_OPTIONS=--random_seed=42,--verbose_gc
Dart VM no longer supports external strings: Dart_IsExternalString,
Dart_NewExternalLatin1String and Dart_NewExternalUTF16String functions are
removed from Dart C API.
Fixes an issue in dart2js where object literal constructors in interop extension types would fail to compile without an @JS annotation on the library
This is a patch release that:
@JS annotation on the
library (issue #55057).await expression, unless the extension type itself implements
Future (issue #55095).Source.name could contain a file paths when a package: or dart: URI should have been used.package:devtools_shared version to ^8.0.1.Breaking Change [#54056][]: The rules for private field promotion have been changed so that an abstract getter is considered promotable if there are n…
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').
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 Meters is an extension type that has representation type
int. It introduces an implicit constructor Meters(int value); and a
getter int get value. m and m.value is the very same object, but m
has type Meters and m.value has type int. The point is that m
has the members of Meters and m.value has the members of int.
Extension types are entirely static, they do not exist at run time. If o
is the value of an expression whose static type is an extension type E
with representation type R, then o is just a normal object whose
run-time type is a subtype of R, exactly like the value of an expression
of type R. Also the run-time value of E is R (for example, E == R
is 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 like is int
at 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.
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
noSuchMethod forwarding 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 x can be changed to int? 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_operatorThese 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.
dart:coreString.fromCharCodes now allow start and end to be after the end of
the Iterable argument, just like skip and take does on an Iterable.dart:ffi@Native can now be used on fields.Native.addressOf.elementAt pointer arithmetic extension methods on
core Pointer types are now deprecated.
Migrate to the new - and + operators instead.@FfiNative annotation has been removed.
Usages should be updated to use the @Native annotation.dart:js_interopJSAny were previously represented using a custom erasure of
@staticInterop types that were compiler-specific. They are now represented
as extension types where their representation types are compiler-specific.
This means that user-defined @staticInterop types that implemented JSAny
or JSObject can no longer do so and need to use
JSObject.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 are now generic
types whose type parameter is a subtype of JSAny?. Conversions to and from
these types are changed to account for the type parameters of the Dart or JS
type, respectively.dart:js_interop extension
members are moved to different extensions on the same type or a supertype to
better organize the API surface. See JSAnyUtilityExtension and
JSAnyOperatorExtension for the new extensions. This shouldn't make a
difference unless the extension names were explicitly used.importModule to allow users to dynamically import modules using the JS
import() expression.dart:js_interop_unsafehas helper to make hasProperty calls more concise.dart:typed_dataBREAKING 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:nativewrappersbase so
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.dart create command now uses v3 of package:lints,
including multiple new recommended lints by default.
To learn more about the updated collection of lints,
check out the package:lints 3.0.0 changelog entry.dart:js_util, package:js, and dart:js
are now disallowed from being imported when compiling with dart2wasm. Prefer
using dart:js_interop and dart:js_interop_unsafe.Type arguments of package:js interop types are now printed as any instead
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.
Invocation that is passed to noSuchMethod will no longer have a
minified memberName, even when dart2js is invoked with --minify.
See #54201 for more details.pubspec.yaml files by
adding an # ignore: <diagnostic_id> comment.dart doc comment directives are now reported.flutter_style_todos lint now has a quick fix.iterable_contains_unrelated_type and
list_remove_unrelated_type lints.
Consider migrating to the expanded
collection_methods_unrelated_type lint.always_require_non_null_named_parametersavoid_returning_null,avoid_returning_null_for_futureUris where they previously used String 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 custom supportsDartUris client capability during initialization.dart-macro+file:/// URIs in communication with the client if the supportsDartUris flag is set in arguments for initializeRequest.package:dap version to 1.2.0.Fixes the left/mobile sidebar being empty on non-class pages in documentation generated with dart doc (issue [#54073][]).
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 test is invoked with the --coverage flag
(SDK issue #54059, Flutter issue #124145).
Upgrades Dart DevTools to version 2.28.3 (issue #54085).
unified_analytics as a dependency and added static method DevToolsUtils.initializeAnalytics to create analytics instance for DevTools.devtools_shared constraint to ^7.0.0.Breaking Change [#53167][]: Use a more precise split point for refutable patterns. Previously, in an if-case statement, if flow analysis could prove t…
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 is tests. 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:
C in the library whose interface contains a
getter with the same name, but C does not have an implementation of that
getter (such unimplemented getters aren't safe for field promotion, because
they are implicitly forwarded to noSuchMethod, 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.
dart:asyncbroadcast parameter to Stream.empty constructor.dart:cliwaitFor is disabled by default and slated for removal in 3.4. Attempting
to call this function will now throw an exception. Users that still depend
on waitFor can enable it by passing --enable_deprecated_wait_for flag
to the VM.dart:convertutf8.encode() and Utf8Codec.encode() from
List<int> to Uint8List.dart:developerService.getIsolateID method.getIsolateId method to Service.getObjectId method to Service.dart:ffiNativeCallable.isolateLocal constructor. This creates
NativeCallables with the same functionality as Pointer.fromFunction,
except that NativeCallable accepts closures.NativeCallable.keepIsolateAlive method, which determines whether
the NativeCallable keeps the isolate that created it alive.NativeCallable constructors can now accept closures. Previously
NativeCallables had the same restrictions as Pointer.fromFunction, and
could only create callbacks for static functions.NativeCallable.nativeFunction now throws an
error if is called after the NativeCallable has already been closed. Calls
to close after the first are now ignored.dart:ioBreaking change #53005: The headers returned by
HttpClientResponse.headers and HttpRequest.headers no longer include
trailing whitespace in their values.
Breaking change #53227: Folded headers values returned by
HttpClientResponse.headers and HttpRequest.headers now have a space
inserted at the fold point.
dart:isolateIsolate.packageConfigSync and Isolate.resolvePackageUriSync APIs.dart:js_interopJSNumber.toDart is removed in favor of toDartDouble and toDartInt to
make the type explicit. Object.toJS is also removed in favor of
Object.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 via JSBoxedDartObject.toDart. Similarly,
JSExportedDartObject is renamed to JSBoxedDartObject and the extensions
ObjectToJSExportedDartObject and JSExportedDartObjectToObject are renamed
to ObjectToJSBoxedDartObject and JSBoxedDartObjectToObject in order to
avoid confusion with @JSExport.dart:js_interop types like JSNumber when used in an external API. This
only affects dart:js_interop classes and not package:js or other forms of
JS interop.dart:js_interop types:
@staticInterop types can subtype only JSObject and JSAny from the set of
JS types in dart:js_interop. Subtyping other types from dart:js_interop
would result in confusing type errors before, so this makes it a static error.dart:js_interop and @staticInterop APIs:
Static interop APIs will now use the same global context as non-static interop
instead of globalThis to avoid a greater migration. Static interop APIs,
either through dart:js_interop or the @staticInterop annotation, have used
JavaScript's globalThis as 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 either self or DDC's global in non-static
interop APIs with package: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's
globalJSObject is also renamed to globalContext and returns the global
context used in the lowerings.dart:js_interop External APIs:
External JS interop APIs when using dart:js_interop are restricted to a set
of allowed types. Namely, this includes the primitive types like String, JS
types from dart:js_interop, and other static interop types (either through
@staticInterop or extension types).dart:js_interop isNull and isUndefined:
null and undefined can 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.dart:js_interop typeofEquals and instanceof:
Both APIs now return a bool instead of a JSBoolean. typeofEquals also
now takes in a String instead of a JSString.dart:js_interop JSAny and JSObject:
These types can only be implemented, and no longer extended, by user
@staticInterop types.dart:js_interop JSArray.withLength:
This API now takes in an int instead of JSNumber.Symbols and BigInts are now associated with their own
interceptor and should not be used with package:js classes. These types were
being intercepted with the assumption that they are a subtype of JavaScript's
Object, but this is incorrect. This lead to erroneous behavior when using
these types as Dart Objects. See #53106 for more details. Use
dart:js_interop's JSSymbol and JSBigInt with extension types to interop
with these types.Symbols and BigInts are now associated with their own
interceptor and should not be used with package:js classes. These types were
being intercepted with the assumption that they are a subtype of JavaScript's
Object, but this is incorrect. This lead to erroneous behavior when using
these types as Dart Objects. See #53106 for more details. Use
dart:js_interop's JSSymbol and JSBigInt with extension types to interop
with these types.dart create command has a new cli template
to quickly create Dart command-line applications
with basic argument parsing capabilities.
To learn more about using the template,
run dart help create.--enable-experiment command-line option to enable language
experiments.annotate_redeclares lint.use_build_context_synchronously lint as stable.dart pub upgrade --tighten which will update dependencies' lower
bounds in pubspec.yaml to match the current version.dart pub get/add/upgrade will now show if a dependency
changed between direct, dev and transitive dependency.dart pub upgrade no longer shows unchanged dependencies.package: URI.devtools_shared to ^6.0.4.--dtd-uri=<uri> flag to DevTools server.vm_service constraint to ^14.0.0.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 initia
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)
devtools_shared constraint to ^6.0.3.stackTraceRequest now returns an empty stack instead of throwing if called for a thread that has exited.vm_service constraint to ^13.0.0.Fixes a bug in the parser which prevented a record pattern from containing a nested record pattern, where the nested record pattern uses record destru
This is a patch release that:
final ((:a, :b), c) = record;
(issue #53352).Breaking change [#52027][]: FileSystemEvent is `sealed`. This means that FileSystemEvent cannot be extended or implemented.
dart:asyncinterface modifier to purely abstract classes:
MultiStreamController, StreamConsumer, StreamIterator and
StreamTransformer. As a result, these types can only be implemented,
not extended or mixed in.dart:coreUri.base on native platforms now respects IOOverrides overriding
current directory (#39796).dart:ffiNativeCallable class, which can be used to create callbacks that
allow native code to call into Dart code from any thread. See
NativeCallable.listener. In future releases, NativeCallable will be
updated with more functionality, and will become the recommended way of
creating native callbacks for all use cases, replacing Pointer.fromFunction.dart:iosameSite to the Cookie class.SameSite.FileSystemEvent is
sealed. This means
that FileSystemEvent cannot be extended or implemented.Platform is instantiated.Platform.lineTerminator which exposes the character or characters
that the operating system uses to separate lines of text, e.g.,
"\r\n" on Windows.dart:js_interopObjectLiteral is removed from dart: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().package:js@staticInterop and external extension members:
external @staticInterop members and external extension members can no
longer be used as tear-offs. Declare a closure or a non-external method that
calls these members, and use that instead.@staticInterop and external extension members:
external @staticInterop members and external extension 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,
calling external void foo([int a, int b]) as foo(0) will now result in
foo(0), and not foo(0, null).analysis_options.yaml file:
Hot-fix release of changes in 3.1.2 without the changes in 3.1.1
Hot-fix release of changes in 3.1.2 without the changes in 3.1.1
devtools_shared constraint to ^6.0.3.stackTraceRequest now returns an empty stack instead of throwing if called for a thread that has exited.Breaking change: Dart 3.0 interprets [switch cases] as patterns instead of constant expressions. Most constant expressions found in switch cases are v…
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, and mixin
on class and mixin declarations 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 a mixin
declaration. 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
continue statement targets a label that is not a loop (for, do and
while statements) or a switch member. Fix this by changing the continue
to 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 (=).
mixin classes in the platform libraries
can no longer be mixed in, unless they are explicitly marked as mixin class.
The following existing classes have been made mixin classes:
IterableIterableMixin (now alias for Iterable)IterableBase (now alias for Iterable)ListMixinSetMixinMapMixinLinkedListEntryStringConversionSinkdart:coreAdded bool.parse and bool.tryParse static methods.
Added DateTime.timestamp() constructor to get current time as UTC.
The type of RegExpMatch.pattern is now RegExp, not just Pattern.
Breaking change #49529:
List constructor, as it wasn't null safe.
Use list literals (e.g. [] for an empty list or <int>[] for an empty
typed list) or List.filled.onError argument on int.parse, double.parse,
and num.parse. Use the tryParse method instead.proxy and Provisional annotations.
The original proxy annotation has no effect in Dart 2,
and the Provisional type and provisional constant
were only used internally during the Dart 2.0 development process.Deprecated.expires getter.
Use Deprecated.message instead.CastError error.
Use TypeError instead.FallThroughError error. The kind of
fall-through previously throwing this error was made a compile-time
error in Dart 2.0.NullThrownError error. This error is never
thrown from null safe code.AbstractClassInstantiationError error. It was made
a compile-time error to call the constructor of an abstract class in Dart 2.0.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.NoSuchMethodError default constructor.
Use the NoSuchMethodError.withInvocation named constructor instead.BidirectionalIterator class.
Existing bidirectional iterators can still work, they just don't have
a shared supertype locking them to a specific name for moving backwards.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 Function type can no longer be implemented, extended or mixed in.
Since Dart 2.0 writing implements Function has been allowed
for backwards compatibility, but it has not had any effect.
In Dart 3.0, the Function type is final and cannot be subtyped,
preventing code from mistakenly assuming it works.
The following declarations can only be implemented, not extended:
ComparableExceptionIteratorPatternMatchRegExpRegExpMatchStackTraceStringSinkNone of these declarations contained any implementation to inherit,
and are marked as interface to signify that they are only intended
as interfaces.
The following declarations can no longer be implemented or extended:
MapEntryOutOfMemoryErrorStackOverflowErrorExpandoWeakReferenceFinalizerThe MapEntry value 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:asyncAdded extension member wait on iterables and 2-9 tuples of futures.
Breaking change #49529:
DeferredLibrary class.
Use the deferred as import syntax instead.dart:collectionAdded extension members nonNulls, firstOrNull, lastOrNull,
singleOrNull, elementAtOrNull and indexed on Iterables.
Also exported from dart:core.
Deprecated the HasNextIterator class (#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.
QueueLinkedListLinkedListEntryHasNextIterator (Also deprecated.)HashMapLinkedHashMapHashSetLinkedHashSetDoubleLinkedQueueListQueueSplayTreeMapSplayTreeSetdart:developerBreaking change #49529:
MAX_USER_TAGS constant.
Use maxUserTags instead.Callbacks passed to registerExtension will be run in the zone from which
they are registered.
Breaking change #50231:
dart:ffi@FfiNative annotation is now deprecated.
Usages should be replaced with the new @Native annotation.dart:htmlregisterElement
and registerElement2 methods in Document and HtmlDocument have been
removed. See #49536 for
details.dart:mathRandom interface can only be implemented, not extended.dart:ioname and signalNumber to the ProcessSignal class.NetworkInterface.listSupported. Has always returned true since
Dart 2.3.httpEnableTimelineLogging parameter name transition from enable
to enabled. See #43638.NetworkProfiling to accommodate new String ids
that are introduced in vm_service:11.0.0dart:js_utildelete and the typeof functionality.jsify is now permissive and has inverse semantics to dartify.jsify and dartify both handle types they understand natively more
efficiently.callMethod has been aligned with the other methods and
now takes Object instead of String.--serve-observatory flag.-k, --kernel, and --dart-sdk.--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.--native-null-assertions, which ensures web library
APIs are sound in their nullability, is by default set to true in sound mode,
unless -O3 or higher is passed, in which case they are not checked. For more
information on the flag, see NATIVE_NULL_ASSERTIONS.md.dart compile js, flutter build, or
build_web_compilers. This is not expected to be a visible change.sync* and async* functions with => bodies.< in collection literals.dart analyze are 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-warnings flag. This behavior can also be altered, on a
code-by-code basis, by changing the severity of rules in an analysis
options file.@Since annotation. 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.Updates the Linter to 1.35.0, which includes changes that
implicit_reopenunnecessary_breakstype_literal_in_constant_patterninvalid_case_patternsenable_null_safetyinvariant_booleansprefer_bool_in_assertsprefer_equal_for_default_valuessuper_goes_lastunnecessary_parenthesis false-positives with null-aware expressions.void_checks to allow assignments of Future<dynamic>? to parameters
typed FutureOr<void>?.use_build_context_synchronously in if conditions.avoid_private_typedef_functions with generalized
type aliases.unnecessary_parenthesis to detect some doubled parens.void_checks to allow returning Never as void.no_adjacent_strings_in_list to support set literals and for- and
if-elements.avoid_types_as_parameter_names to handle type variables.avoid_positional_boolean_parameters to handle typedefs.avoid_redundant_argument_values to check parameters of redirecting
constructors.prefer_const_literals_to_create_immutables.use_build_context_synchronously to check context properties.unnecessary_parenthesis support for property accesses and method
invocations.unnecessary_parenthesis to allow parentheses in more null-aware
cascade contexts.unreachable_from_main to track static elements.unnecessary_null_checks to not report on arguments passed to
Future.value or Completer.complete.always_use_package_imports and prefer_relative_imports as
incompatible rules.only_throw_errors to not report on Never-typed expressions.unnecessary_lambdas to not report with late final variables.avoid_function_literals_in_foreach_calls to not report with nullable-
typed targets.deprecated_member_use_from_same_package which replaces the
soft-deprecated analyzer hint of the same name.public_member_api_docs to not require docs on enum constructors.prefer_void_to_null to not report on as-expressions.The null safety migration tool (dart migrate) has been removed. If you still
have code which needs to be migrated to null safety, please run dart migrate
using Dart version 2.19, before upgrading to Dart version 3.0.
To preserve compatibility with null-safe code pre Dart 3, Pub will interpret a
language constraint indicating a language version of 2.12 or higher and an
upper bound of <3.0.0 as <4.0.0.
For example >=2.19.2 <3.0.0 will be interpreted as >=2.19.2 <4.0.0.
dart pub publish will no longer warn about dependency_overrides. Dependency
overrides only take effect in the root package of a resolution.
dart pub token add now verifies that the given token is valid for including
in a header according to RFC 6750 section
2.1. 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 get and related commands will now by default also update the
dependencies in the example folder (if it exists). Use --no-example to
avoid this.
On Windows the PUB_CACHE has moved to %LOCALAPPDATA%, since Dart 2.8 the
PUB_CACHE has been created in %LOCALAPPDATA% when one wasn't present.
Hence, this only affects users with a PUB_CACHE created by Dart 2.7 or
earlier. If you have path/to/.pub-cache/bin in PATH you may need to
update your PATH.
DartDebugAdapter.vmService from VmServiceInterface to VmService.[DAP] restartFrameRequest is now supported for frames up until the first async boundary (that are not also the top frame).
restartFrameRequest is now supported for frames up until the first async boundary (that are not also the top frame).vm_service version to >=11.0.0 <13.0.0.[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 allo
threadIds has been reverted because Isolate numbers can be larger than the 32-bit integers allowed in DAP.threadsRequest from the DDS DAP handler now include isolateId fields to allow mapping back to VM Service Isolates.Updated devtools_shared to ^2.26.1.
devtools_shared to ^2.26.1.This is a patch release that fixes DDC to handle a breaking change in Chrome (issue [#43193][]).
This is a patch release that fixes DDC to handle a breaking change in Chrome (issue #43193).
threadIds generated by the debug adapter now match the Isolate numbers of the underlying isolates.frameId) is now available for top-levels if a file:// URI for a script is provided as the context for an evaluate request.This is a patch release that fixes transient StackOverflow exceptions when building Flutter applications (issue [flutter/flutter#63560][]).
This is a patch release that fixes transient StackOverflow exceptions when building Flutter applications (issue flutter/flutter#63560).
source.path field if the working directory of the debug adapter did not match that of the launch/attach request.bool? allowAnsiColorOutput can enable using ansi color codes in Output events to improve readability of stack traces (fading out frames that are not user code).This is a patch release that fixes unhandled exceptions in some Flutter applications (issue [flutter/flutter#63038][]).
This is a patch release that fixes unhandled exceptions in some Flutter applications (issue flutter/flutter#63038).
bool? showGettersInDebugViews allows getters to be shown wrapped in Variables/Evaluation responses so that they can be lazily expanded by the user. evaluateGettersInDebugViews must be false for this behaviour.runInTerminal requests are now sent after first responding to the launchRequest.! instead of ✓ in Output events.pause request.IsolateReload events
(see https://dartbug.com/49491).Breaking change [#41100][]: When encoding a string containing unpaired surrogates as UTF-8, the unpaired surrogates will be encoded as replacement cha…
dart:asyncStream.multi constructor creating streams which can be listened to more
than once, and where each individual listener can be controlled independently.dart:convertU+FFFD). When decoding UTF-8, encoded surrogates will be treated
as malformed input. When decoding UTF-8 with allowMalformed: true, the
number of replacement characters emitted for malformed input sequences has
been changed to match the WHATWG encoding standard.dart:ioexit has been changed to return the Nevertype
instead of void. since no code will run after it,OSError now implements Exception. This change means OSError will
now be caught in catch clauses catching Exceptions.InternetAddress.tryParse.InternetAddress with address starting with '@' and type being
InternetAddressType.Unix will create an abstract Unix Domain Socket.Directory.current does not work with
long path.dart:htmlBreaking change: CssClassSet.add() previously returned null if the
CssClassSet corresponded to multiple elements. In order to align with the
null-safe changes in the Set interface, it will now return false instead.
The same applies for CssClassSet.toggle.
EventStreamSubscription.cancel method used to return null, but since
StreamSubscription.cancel has changed to be non-nullable, this method
returns an empty Future instead. Due to an optimization on null Futures,
this method used to complete synchronously, but now that the Future is empty
instead, it completes asynchronously, therefore potentially invalidating code
that relied on the synchronous side-effect. This change will only affect code
using sound null-safety. See issue #41653 for more details.
Methods in Console have been updated to better reflect the modern Console
specification. Particularly of interest are dir and table which take in
extra optional arguments.
dart:mirrorsBreaking change #42714: web compilers (dart2js and DDC) now produce a
compile-time error if dart:mirrors is imported.
Most projects should not be affected. Since 2.0.0 this library was unsupported
and produced runtime errors on all its APIs. Since then several tools already
reject code that use dart:mirrors including webdev and flutter tools, we
expect few projects to run into this problem.
--fix-single-cascade-statements.var in --fix-function-typedefs.?.[] to ?[].// ignore: code and // ignore_for_file: code).Updated the Linter to 0.1.117, which includes:
do_not_use_environment.exhaustive_cases.no_default_cases (experimental).sized_box_for_whitespace.use_is_even_rather_than_modulo.directives_ordering to remove third party package special-casing.prefer_is_empty to special-case assert initializers and const
contexts.prefer_mixin to allow "legacy" SDK abstract class mixins.sized_box_for_whitespace to address false-positives.type_annotate_public_apis to allow inferred types in final field
assignments.unnecessary_lambdas to check for tear-off assignability.unsafe_html to use a SecurityLintCode (making it un-ignorable) and
to include Window.open, Element.html and DocumentFragment.html in unsafe
API checks. Also added checks for attributes and methods on extensions.print
function, the default implementation (used when not overridden by the embedder
or the current zone) will print any unpaired surrogates in the string as
replacement characters (U+FFFD). Similarly, the Dart_StringToUTF8 function
in the Dart API will convert unpaired surrogates into replacement characters.pub run and pub global run accepts a --enable-experiment flag enabling
experiments in the Dart VM (and language).pub outdated:
pubspec.lock file. When the lockfile is missing, the
Current column is empty.pub upgrade: Show summary count of outdated packages after running. It will
also only show newer packages if they are not prereleases or the package is
already a prerelease.pub run: Fix precompilation with relative PUB_CACHE paths
(#2486).pubspec.lock if they are already there
(#2489).Nothing published for this version
This is a patch release that fixes the following issues:
This is a patch release that fixes the following issues:
This is a patch release that fixes an AOT compilation bug in global transformations which manifests as a NoSuchMethod exception (issue [flutter/flutte
This is a patch release that fixes an AOT compilation bug in global transformations which manifests as a NoSuchMethod exception (issue flutter/flutter#56479).
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…
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.
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, or with Function have no effect
(spec section 19.6). We fixed an implementation bug that may be visible on
some rare scenarios.
dart:asyncBreaking change #40676: Changed the return type of
StreamSubscription.cancel() to Future<void>. Previously, it was declared
to return Future and was allowed to return null at runtime.
Breaking change #40681: The runZoned() function is split into two
functions: runZoned() and runZonedGuarded(), where the latter has a
required onError parameter, and the former has none. This prepares the
functions for null safety where the two functions will differ in the
nullability of their return types.
Breaking change #40683: Errors passed to Completer.completeError(),
Stream.addError(), Future.error(), etc. can no longer be null. These
operations now synchronously throw an exception if passed a null error.
Make stack traces non-null #40130. Where methods like
completer.completeError() allow omitting a stack trace, the platform will
now insert a default stack trace rather than propagate a null value.
Error handling functions need no longer be prepared for null stack traces.
dart:coreBreaking change #40674: Three members on RuneIterator no longer
return null when accessed before the first call to moveNext(). Instead,
current and rawIndex return -1 and currentAsString returns an empty
string.
Breaking change #40678: The String.fromEnvironment() default value
for defaultValue is now an empty string instead of null. Likewise, the
default value for int.fromEnvironment()'s defaultValue parameter is zero.
Under null safety, a constructor cannot return null, so this prepares these
APIs for that.
The class CastError is deprecated, and all implementation specific classes
implementing TypeError or CastError now implement both. In a future
release, CastError will be removed. See issue 40763 for details.
Adds StackTrace.empty constant which is the stack trace used as default
stack trace when no better alternative is available.
The class TypeError no longer extends AssertionError. This also means that
it no longer inherits the spurious message getter which was added to
AssertionError when the second operand to assert was allowed. The value of
that getter on a TypeError was the same string as returned by toString(),
so it is still available.
ArgumentError.checkNotNull() and the RangeError static methods
checkValueInInterval(), checkValidIndex() and checkNotNegative() all
return their first argument on success. This makes these functions more
convenient to use in-line in, for example, => function bodies or constructor
initialization lists.
dart:developerTimelineTask now accept an optional filterKey
parameter. If provided, the arguments for all events associated with the task
will contain an entry named filterKey, set to the value of the filterKey
parameter provided in the constructor. This will be used by tooling to allow
for better filtering of timeline events.dart:ffiBreaking change: Changed Pointer.asFunction() and
DynamicLibrary.lookupFunction() to extension methods. Invoking them
dynamically previously already threw an exception, so the runtime behavior
stays the same. However, the extension methods are only visible if dart:ffi
is imported directly. This breaks code where dart:ffi is not directly
imported. To fix, add:
import 'dart:ffi';
dart:htmlBreaking change #39627: Changed the return type of several HTML native
methods involving futures. In return types that matched Future<List<T>>,
T was changed to dynamic. These methods would have resulted in a runtime
error if they were used.
Breaking change: Node.insertAllBefore() erroneously had a return type of
Node, even though it was not returning anything. This has been corrected to
void.
dart:ioClass HttpParser will no longer throw an exception when a HTTP response
status code is within [0, 999]. Customized status codes in this range are now
valid.
Breaking change #33501: The signature of HttpHeaders methods add()
and set have been changed to:
void add(String name, Object value, {bool preserveHeaderCase: false})
void set(String name, Object value, {bool preserveHeaderCase: false})
Setting preserveHeaderCase to true preserves the case of the name
parameter instead of converting it to lowercase. The HttpHeader.forEach()
method provides the current case of each header.
This is breaking only for classes extending or implementing HttpHeaders and
having their own add or set methods without the bool preserveHeaderCase
named parameter.
Breaking change #40702: The Socket class now throws a
SocketException if the socket has been explicitly destroyed or upgraded to a
secure socket upon setting or getting socket options. Previously, setting a
socket option would be ignored and getting a socket option would return
null.
Breaking change #40483: The Process class now throws a StateError
if the process is detached (ProcessStartMode.detached and
ProcessStartMode.detachedWithStdio) upon accessing the exitCode getter. It
now also throws when not connected to the child process's stdio
(ProcessStartMode.detached and ProcessStartMode.inheritStdio) upon
accessing the stdin, stdout, and stderr getters. Previously, these
getters would all return null.
Breaking change #40706: The dummy object returned if FileStat.stat()
or FileStat.statSync() fail now contains Unix epoch timestamps instead of
null for the accessed, changed, and modified getters.
Breaking change #40709: The HeaderValue class now parses more
strictly in two invalid edge cases. This is the class used to parse the
semicolon delimited parameters used in the Accept, Authorization,
Content-Type, and other such HTTP headers.
The empty parameter value without double quotes (which is not allowed by the
standards) is now parsed as the empty string rather than null. E.g.
HeaderValue.parse("v;a=").parameters now gives {"a": ""} rather than
{"a": null}.
Invalid inputs with unbalanced double quotes are now rejected. E.g.
HeaderValue.parse('v;a="b').parameters will now throw a HttpException
instead of giving {"a": "b"}.
The HeaderValue.toString() method now supports parameters with null values
by omitting the value. HeaderValue("v", {"a": null, "b": "c"}).toString()
now gives v; a; b=c. This behavior can be used to implement some features in
the Accept and Sec-WebSocket-Extensions headers.
Likewise the empty value and values using characters outside of RFC 7230 tokens are now correctly implemented by double quoting such values with escape sequences. For example:
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 InternetAddress of InternetAddressType.Unix into
the connect(), startConnect() and bind() methods. The port argument in
those methods will be ignored. The port getter always returns 0 for Unix
domain sockets.
Class InternetAddressType gains one more option Unix, which represents a
Unix domain address.
Class InternetAddress:
InternetAddress constructor gains an optional type parameter. To create
a Unix domain address, type is set to InternetAddressType.Unix and
address is a file path.
InternetAddress gains a new constructor fromRawAddress() that takes an
address in byte format for Internet addresses or raw file path for Unix
domain addresses.
Breaking change #40681: The static methods runZoned() and
runWithHttpOverrides() on HttpOverrides no longer accept
zoneSpecification and onError parameters. Use the runZoned() or
runZonedGuarded() functions from dart:async directly if needing to specify
those.
Class HttpClient and HttpServer, when receiving HttpRequest or
HttpClientResponse, will now put a 8K size limit on its header fields and
values.
dart:mirrorsMirrorSystem.neverType.Added Dart_TypeDynamic, Dart_TypeVoid and Dart_TypeNever. Type dynamic
can no longer by reached using Dart_GetType(dart:core, dynamic).
Added the following methods to the VM embedding API:
Dart_GetNonNullableType()Dart_GetNullableType()Dart_TypeToNonNullable()Dart_TypeToNullable()Dart_IsLegacyType()Dart_IsNonNullableType()Dart_IsNullableType()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 --kernel option is now ignored and defaults to true. There is no
longer any way to invoke the legacy (analyzer based) version of DDC.
Command line arguments that were only used for the legacy DDC have been removed.
The pre-compiled dart_sdk.js artifacts generated by legacy DDC have been
deleted from dart-sdk/lib/dev_compiler in favor of the versions located at
dart-sdk/lib/dev_compiler/kernel.
Breaking change: Functions passed to JavaScript using the recommended
package:js interop specification must now be wrapped with a call to
allowInterop. This behavior was always enforced by Dart2JS, but was not
enforced consistently by DDC. It is now enforced by both.
Breaking change: Constructors in @JS() classes must be marked with
external. Previously the external could be omitted in some cases with DDC
but doing so would cause incorrect behavior with Dart2JS.
JS interop classes with an index operator are now static errors.
All remaining support from the dart:mirrors library has been removed. Use of
this library on the web has been unsupported and prevented by the Dart build
systems since Dart v2.0.0. All known exception cases have been cleaned up.
This change makes DDC and Dart2JS now behave consistently.
The library can still be imported on web apps, but all APIs throw. In a future breaking change release, imports to this library will likely become a compile-time error.
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 -O3 where checks are omitted altogether. Even with -O3, the
performance of some is checks used by your app may improve.
When using -O3 and -O4 incorrect type annotations could surface as errors.
The old type representation was accidentally lenient on some invalid type
annotations. We have only encountered this issue on programs that were not
tested properly at the js-interop program boundary.
Type.toString() has a small change that is rarely visible. For a long time,
Dart2JS has had support to erase unused type variables. Today, when Dart2JS is
given --lax-runtime-type-to-string (currently included in -O2, -O3, and
-O4) and it decides to erase the type variable of a class Foo<T>, then it
compiles expressions like foo.runtimeType.toString() to print Foo. With
the new representation, this will show Foo<erased> instead. This change may
be visible in error messages produced by type checks involving erased types.
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-rti to 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 with
external. Previously, the external could be omitted for unused constructors.
Omitting external for a constructor which is used would cause incorrect
behavior at runtime, now omitting it on any constructor is a static error.
Other dart2js changes:
--package-root flag, which was hidden and disabled
in Dart 2.0.0, has been completely removed. Passing this flag will now cause
dart2js to fail.Updated the Linter to 0.1.114, which includes:
avoid_shadowing_type_parameters to support extensions and mixins.non_constant_identifier_names to allow named constructors made up of
only underscores (_).avoid_unused_constructor_parameters to ignore unused params named in
all underscores (_)..analysis_options.Added pub outdated command which lists outdated package dependencies, and
gives advice on how to upgrade.
pub get and pub upgrade now fetch version information about hosted
dependencies in parallel, improving the time package resolution performance.
pub get and pub upgrade no longer precompile executables from dependencies
by default. Instead they are precompiled on first pub run. Use
pub get --precompile to get the previous behavior.
Fixed missing retries of DNS failures during pub get.
If code contains imports for packages not listed in the package's
pubspec.yaml then pub publish will reject the package.
pub publish no longer requires the presence of a homepage field, if the
repository field is provided.
pub publish warns if non-pre-release packages depends on pre-release
packages or pre-release Dart SDKs.
Relative paths in pubspec.lock now use / also on Windows to make the file
sharable between machines.
Fixed language version in .dart_tool/package_config.json
for packages without an explicit SDK constraint. Pub now writes an empty
language version where before the language version of the current SDK would be
used.
%LOCALAPPDATA% is now preferred over %APPDATA% when creating a pub cache
directory on Windows. %LOCALAPPDATA% is not copied when users roam between
devices.
pub publish warns if LICENSE and README.md files are not called those exact
names.
pub repair cache downloads hosted packages in parallel.
getPerfettoVMTimelineWithCpuSamples RPC.vm_service version to >=11.0.0 <12.0.0.Nothing published for this version
[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.
[DAP] Configuring and resuming isolates will no longer cause a crash if the isolate exits before the request is processed.
[DAP] Sentinel values (such as uninitialized fields/locals) will no longer cause scopesRequest/variablesRequest to fail, instead showing appropriate t
scopesRequest/variablesRequest to fail, instead showing appropriate text (like "<not initialized>") against the variable.[DAP] Debug adapters now only call setLibraryDebuggable when the debuggable flag changes from the default/current values, reducing the amount of VM Se
setLibraryDebuggable when the debuggable flag changes from the default/current values, reducing the amount of VM Service traffic for new isolates/reloads.breakpoint events are no longer sometimes sent prior to the response to the setBreakpointsRequest that created them.[DAP] scopesRequest now returns a Globals scope containing global variables for the current frame.
scopesRequest now returns a Globals scope containing global variables for the current frame.setBreakpointsRequest will now have verified: false and will send breakpoint events to update verified and/or line/column as the VM resolves them.Updated vm_service version to >=9.0.0 <12.0.0.
vm_service version to >=9.0.0 <12.0.0.[DAP] Added support for ,d (decimal), ,h (hex) and ,nq (no quotes) format specifiers to be used as suffixes to evaluation requests.
,d (decimal), ,h (hex) and ,nq (no quotes) format specifiers to be used as suffixes to evaluation requests.format.hex in variablesRequest and evaluateRequest.[DAP] Added support for displaying records in responses to variablesRequest.
variablesRequest.ExistingDartDevelopmentServiceException (extending DartDevelopmentServiceException) is thrown when trying to connect DDS to a VM Service that already has a DDS instance. This new exception contains a ddsUri field that is populated with the URI of the existing DDS instance if provided by the target VM Service.…of previousSibling. See the security advisory [CVE-2020-8923][cve-2020-8923] for more details. Thanks to Vincenzo di Cicco for finding and reporting t…
Security advisory: This is a patch release that addresses a vulnerability in
dart:html NodeValidator related to DOM clobbering of previousSibling.
See the security advisory CVE-2020-8923 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).
ToolEvent stream as dart.toolEvent DAP events.Breaking change: The Dart SDK for macOS is now only available for x64 (issue [39810][]).
vm_service version to >=9.0.0 <11.0.0.Breaking change: [Static extension members][] are accessible when imported with a prefix (issue [671][]). In the extension method preview launch, impo…
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
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
}
```
dart:ioIOOverrides.serverSocketBind to aid in writing
tests that wish to mock ServerSocket.bind.dart:typed_data.sublistView(TypedData, [start, end]) to all
TypedData classes. The constructor makes it easier, and less error-prone, to
create a view of (a slice of) another TypedData object.The Linter was updated to 0.1.104, which includes:
unnecessary_overrides to allow overrides when annotations (besides
@override are specified)file_names to allow names w/ leading _'s (and improved
performance)unnecessary_finalpub get generates
.dart_tool/package_config.json
in addition to .packages to support language versioning.
pub publish now warns about the old flutter plugin registration format.
pub publish now warns about the author field in pubspec.yaml being.
obsolete.
Show a proper error message when git is not installed.
DartDevelopmentService.setExternalDevToolsUri(Uri uri), adding support for registering an external DevTools server with DDS.Breaking change #37985: Inference is changed when using Null values in a FutureOr context. Namely, constraints of the forms similar to Null <: FutureO…
[IN PREVIEW] Static extension members: A new language feature allowing specially declared static functions to be invoked like instance members on expressions of appropriate static types is available in preview.
Static extension members are declared using a new extension declaration.
Example:
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 by intList matching the List<T> "on" type
of the declaration. An extension member cannot be called implicitly on an
expression whose static type has a member with the same base-name. In that
case, the interface member takes precedence. If multiple extension members
apply to the same implicit invocation, the most specific one is used, if there
is one such.
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 Null values in a FutureOr context. Namely,
constraints of the forms similar to Null <: FutureOr<T> now yield Null
as the solution for T. For example, the following code will now print
"Null", and it was printing "dynamic" before (note that the anonymous closure
() {} in the example has Null as its return type):
import 'dart:async';
void foo<T>(FutureOr<T> Function() f) { print(T); }
main() { foo(() {}); }
dart:mirrors.dart:developerparent parameter to TimelineTask constructor to allow for
linking of asynchronous timeline events in the DevTools timeline view.dart:ffidart:ffi API to be more precise with types, and
provide convenient access to memory through extension getters and setters. The
extension members on Pointer provide .value and .value = for accessing
the value in native memory and [] and []= for indexed access. The method
asExternalTypedData has been replaced with asTypedList extension methods.
And finally, Structs do no longer have a type argument and are accessed
using the extension member .ref on Pointer. These changes makes the code
using dart:ffi much more concise.Pointer.allocate and Pointer.free). Instead, memory management is
available in package:ffi.Pointer.offsetBy was removed, use cast and
elementAt instead.dart:ffi static errors.dart:ioenableTimelineLogging property to HttpClient which, when enabled,
will post HTTP connection and request information to the developer timeline
for all HttpClient instances.The Linter was updated to 0.1.101, which includes:
diagnostic_describe_all_properties to flag properties in
Diagnosticables with no debug methods definednoSuchMethod exception in camel_case_extensions when analyzing
unnamed extensionsavoid_print to catch tear-off usageavoid_web_libraries_in_flutter (experimental)unnecessary_lambdas for coming MethodInvocation vs.
FunctionExpressionInvocation changeslaunch/attach requests will now result in a clear error message in an error response instead of terminating the adapter.Breaking change #36900: The following methods and properties across various core libraries, which used to declare a return type of List , were updated…
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:
e as T) and type tests (e is T).null, even for types which override the == operator.&, |, and ^ binary operators on booleans.... and ...?).if element 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:
&& operator only evaluates its second operand if the first evaluates to
true.|| operator only evaluates its second operand if the first evaluates to
false.?? operator only evaluates its second operand if the first evaluates to
null.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;
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
of Uint8List:
BytesBuilder.takeBytes()BytesBuilder.toBytes()Datagram.dataFile.readAsBytes() (Future<Uint8List>)File.readAsBytesSync()InternetAddress.rawAddressRandomAccessFile.read() (Future<Uint8List>)RandomAccessFile.readSync()RawSocket.read()Utf8Codec.encode() (and Utf8Encoder.convert())In addition, the following classes were updated to implement
Stream<Uint8List> rather than Stream<List<int>>:
HttpRequestSocketPossible 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 of Stream.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() → Uint64Listdart:asyncvalue and error constructors on Stream to allow easily creating
single-value or single-error streams.dart:coreUpdate Uri class 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:ioBreaking change #37192:
The Cookie class's constructor's name and value optional positional
parameters are now mandatory. The signature changes from:
Cookie([String name, String value])
to
Cookie(String name, String value)
However, it has not been possible to set name and value to null since Dart
1.3.0 (2014) where a bug made it impossible. Any code not using both
parameters or setting any to null would necessarily get a noSuchMethod
exception at runtime. This change catches such erroneous uses at compile time.
Since code could not previously correctly omit the parameters, this is not
really a breaking change.
Breaking change #37192:
The Cookie class's name and value setters now validates that the strings
are made from the allowed character set and are not null. The constructor
already made these checks and this fixes the loophole where the setters didn't
also validate.
The Linter was updated to 0.1.96, which includes:
unnecessary_parensDartdoc was updated to 0.28.4; this version includes several fixes and is
based on a newer version of the analyzer package.
variables requests now treat lists from dart:typed_data (such as Uint8List) like standard List instances and return their elements instead of class fields.variables requests now return information about the number of items in lists to allow the client to page through them.terminated events are now always sent when detaching whether or not the debuggee terminates after unpause.orgDartlangSdkMappings to control mappings of org-dartlang-sdk:/// paths.Breaking change: Isolate.resolvePackageUri will always throw an UnsupportedError when compiled with dart2js or DDC. This was the only remaining API in…
dart:isolateTransferableTypedData class was added to facilitate faster cross-isolate
communication of Uint8List data.
Breaking change: Isolate.resolvePackageUri will always throw an
UnsupportedError when compiled with dart2js or DDC. This was the only
remaining API in dart:isolate that didn't automatically throw since we
dropped support for this library in Dart 2.0.0. Note that the API already
throws in dart2js if the API is used directly without manually setting up a
defaultPackagesBase hook.
dart:developerresult, errorCode and errorDetail getters in
ServiceExtensionResponse to allow for better debugging of VM service
extension RPC results.dart:ioFixed Cookie class interoperability with certain websites by allowing the
cookie values to be the empty string (Issue 35804) and not stripping
double quotes from the value (Issue 33327) in accordance with RFC 6265.
#36971: The
HttpClientResponse interface has been extended with the addition of a new
compressionState getter, which specifies whether the body of a response was
compressed when it was received and whether it has been automatically
uncompressed via HttpClient.autoUncompress.
As part of this change, a corresponding new enum was added to dart:io:
HttpClientResponseCompressionState.
This is a breaking change for those implementing the HttpClientResponse
interface as subclasses will need to implement the new getter.
dart:asyncawait for allowed null as a stream due to a bug in StreamIterator
class. This bug has now been fixed.dart:core#36171: The RegExp
interface 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, RegExp methods that originally returned Match objects 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 groupThis is a breaking change for implementers of the RegExp interface.
Subclasses will need to add the new properties and may have to update the
return types on overridden methods.
class A<X> {};
class B<X> extends A<void Function(X)> {};
async can now be used in asynchronous and generator
functions.NoSuchMethod errors for failing dynamic calls. Now they include
specific information about the nature of the error such as:
call() method.The Linter was updated to 0.1.91, which includes the following changes:
prefer_const_constructorsprefer_initializing_formals to no longer suggest API breaking changesomit_local_variable_types to allow explicit dynamicsunrelated_type_equality_checksunsafe_htmlprefer_null_aware_operators to work beyond local variables.prefer_if_null_operators.prefer_contains false positives.unnecessary_parenthesis false positives.prefer_asserts_in_initializer_lists false positivescurly_braces_in_flow_control_structures to handle more casesprefer_double_quotessort_child_properties_lasttype_annotate_public_apis false positive for static const
initializerspub publish will no longer warn about missing dependencies for import
statements in example/.openid scope.DartDebugAdapter.startProgressNotification.
Standard progress events are sent when a clients sets supportsProgressReporting: true in its capabilities,
unless sendCustomProgressEvents: true is included in launch configuration, in which case prefixed (dart.) custom notifications will be sent instead.This is a patch version release with bug fixes.
This is a patch version release with bug fixes.
Sentinel responses in IsolateManager.initialize().Support for deprecated flags '-c' and '--checked' has been removed.
The focus in this release is on the new "UI-as-code" language features which make collections more expressive and declarative.
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.
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 ...?.
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 if inside collection literals to conditionally omit or (with
else) 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 collection if can 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)),
]
],
);
}
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 for inside a collection literal. Each
iteration of the loop produces an element which is then inserted in the
resulting collection. Consider the following code:
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 if inside const collections.
dart:isolatedebugName property to Isolate.debugName optional parameter to Isolate.spawn and
Isolate.spawnUri.dart:coreThe VM service now requires an authentication code by default. This behavior
can be disabled by providing the --disable-service-auth-codes flag.
Support for deprecated flags '-c' and '--checked' has been removed.
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_info that provide similar features to those in the
visualizer.
The command-line tools in package:dart2js_info also work with the old JSON
format, so you can start using them even before you enable the new format.
In a future release --dump-info will default to --dump-info=binary. At
that point, there will be an option to fallback to the JSON format, but the
visualizer tool will be deprecated.
A release after that, the JSON format will no longer be available from
dart2js, but may be available from a command-line tool in
package:dart2js_info.
The Linter was updated to 0.1.86, which includes the following changes:
prefer_inlined_adds,
prefer_for_elements_to_map_fromIterable,
prefer_if_elements_to_conditional_expressions,
diagnostic_describe_all_properties.file_names to skip prefixed-extension Dart files (.css.dart,
.g.dart, etc.).unnecessary_parenthesis.pub publish without
mentioning the current version.pub publish.pub global activateing package from a custom pub URL.pub logout. Logs you out of the current session.Initial support for compiling Dart apps to native machine code has been added.
Two new tools have been added to the bin folder of the Dart SDK:
dart2aot: AOT (ahead-of-time) compiles a Dart program to native machine
code. The tool is supported on Windows, macOS, and Linux.
dartaotruntime: A small runtime used for executing an AOT compiled program.
resumeIfStarting from DartDebugAdapter.connectDebugger.Sentinel responses in IsolateManager.initialize().Your coding agent can read these notes before it upgrades. Set up the MCP server →