NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
pub.dev, #127 most downloaded on pub.dev
A service that proxies between the Chrome debug protocol and the Dart VM service protocol.
Latest stable
27.2.1
Last release 10 days ago
03 Nov 2026
Ships fairly regularly
a new release about every 5 weeks
Most releases are documented
notes for 52 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
8 years old
158 releases · first in 2019
Drag across the ruler to compare, or tap a release to open it.
Fixes a compiler crash involving redirecting factories and FFI (issue [#124369]).
This is a patch release that:
void in a switch case expression
(issue #52191).when and as as variable names in patterns
(issue #52260).package_resolver and use package_config instead.>=2.7.0.Your coding agent can read these notes before it upgrades. Set up the MCP server →
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.
package:vm_service version 4.0.0.Breaking Changes:
LoadStrategy for module information:
Fix an issue where we would return prematurely during a hotRestart.
hotRestart.hotRestart had to fall
back to a full reload.The Dart 1.0 syntax is supported but deprecated.
This is the first major version release of Dart since 1.0.0, so it contains many significant changes across all areas of the platform. Large changes include:
(Breaking) The unsound optional static type system has been replaced with a sound static type system using type inference and runtime checks. This was formerly called "strong mode" and only used by the Dart for web products. Now it is the one official static type system for the entire platform and replaces the previous "checked" and "production" modes.
(Breaking) Functions marked async now run synchronously until the first
await statement. Previously, they would return to the event loop once at the
top of the function body before any code runs (issue 30345).
(Breaking) Constants in the core libraries have been renamed from
SCREAMING_CAPS to lowerCamelCase.
(Breaking) Many new methods have been added to core library classes. If you implement the interfaces of these classes, you will need to implement the new methods.
(Breaking) "dart:isolate" and "dart:mirrors" are no longer supported when using Dart for the web. They are still supported in the command-line VM.
(Breaking) Pub's transformer-based build system has been replaced by a new build system.
The new keyword is optional and can be omitted. Likewise, const can be
omitted inside a const context (issue 30921).
Dartium is no longer maintained or supported.
"Strong mode" is now the official type system of the language.
The new keyword is optional and can be omitted. Likewise, const can be
omitted inside a const context.
A string in a part of declaration may now be used to refer to the library
this file is part of. A library part can now declare its library as either:
part of name.of.library;
Or:
part of "uriReferenceOfLibrary.dart";
This allows libraries with no library declarations (and therefore no name) to have parts, and it allows tools to easily find the library of a part file. The Dart 1.0 syntax is supported but deprecated.
Functions marked async now run synchronously until the first await
statement. Previously, they would return to the event loop once at the top of
the function body before any code runs (issue 30345).
The type void is now a Top type like dynamic, and Object. It also now
has new errors for being used where not allowed (such as being assigned to any
non-void-typed parameter). Some libraries (importantly, mockito) may need to
be updated to accept void values to keep their APIs working.
Future flattening is now done only as specified in the Dart 2.0 spec, rather
than more broadly. This means that the following code has an error on the
assignment to y.
test() {
Future<int> f;
var x = f.then<Future<List<int>>>((x) => []);
Future<List<int>> y = x;
}
Invocations of noSuchMethod() receive default values for optional args. The
following program used to print "No arguments passed", and now prints "First
argument is 3".
abstract class B {
void m([int x = 3]);
}
class A implements B {
noSuchMethod(Invocation i) {
if (i.positionalArguments.length == 0) {
print("No arguments passed");
} else {
print("First argument is ${i.positionalArguments[0]}");
}
}
}
void main() {
A().m();
}
Bounds on generic functions are invariant. The following program now issues an invalid override error (issue 29014):
class A {
void f<T extends int>() {}
}
class B extends A {
@override
void f<T extends num>() {}
}
Numerous corner case bugs around return statements in synchronous and asynchronous functions fixed. Specifically:
An empty return; in an async function with return type Future<Object> does
not report an error.
return exp; where exp has type void in an async function is now an error
unless the return type of the function is void or dynamic.
Mixed return statements of the form return; and return exp; are now
allowed when exp has type void.
A compile time error is emitted for any literal which cannot be exactly represented on the target platform. As a result, dart2js and DDC report errors if an integer literal cannot be represented exactly in JavaScript (issue 33282).
New member conflict rules have been implemented. Most cases of conflicting members with the same name are now static errors (issue 33235).
Replaced UPPER_CASE constant names with lowerCamelCase. For example,
HTML_ESCAPE is now htmlEscape.
The Web libraries were re-generated using Chrome 63 WebIDLs (details).
dart:asyncStream:
cast and castFrom.firstWhere, lastWhere, and singleWhere to return Future<T>
and added an optional T orElse() callback.StreamTransformer: added cast and castFrom.StreamTransformerBase: new class.Timer: added tick property.Zone
bindBinaryCallbackGuarded, bindCallbackGuarded, and
bindUnaryCallbackGuarded.Zone.ROOT to Zone.root.defaultValue parameter on Stream.firstWhere and
Stream.lastWhere.dart:cliwaitFor: function that suspends a stack to wait for a Future to complete.dart:collectionMapBase: added mapToString.LinkedHashMap no longer implements HashMapLinkedHashSet no longer implements HashSet.of constructor to Queue, ListQueue, DoubleLinkedQueue,
HashSet, LinkedHashSet, SplayTreeSet, Map, HashMap, LinkedHashMap,
SplayTreeMap.Maps class. Extend MapBase or mix in MapMixin instead to provide
map method implementations for a class.Document method getCSSCanvasContext and property
supportsCssCanvasContext.Element property xtag no longer supported in browsers.ServiceWorker class.MessageChannel and MessagePort addEventListener
automatically calls start method to receive queued messages.dart:convertBase64Codec.decode return type is now Uint8List.JsonUnsupportedObjectError: added partialResult propertyLineSplitter now implements StreamTransformer<String, String> instead of
Converter. It retains Converter methods convert and
startChunkedConversion.Utf8Decoder when compiled with dart2js uses the browser's TextDecoder in
some common cases for faster decoding.ASCII, BASE64, BASE64URI, JSON, LATIN1 and UTF8 to
ascii, base64, base64Uri, json, latin1 and utf8.HtmlEscapeMode constants UNKNOWN, ATTRIBUTE, SQ_ATTRIBUTE
and ELEMENT to unknown, attribute, sqAttribute and elements.jsonEncode, jsonDecode, base64Encode, base64UrlEncode and
base64Decode top-level functions.encode on AsciiCodec and Latin1Codec, and
convert on AsciiEncoder, Latin1Encoder, to Uint8List.utf8.decoder.fuse(json.decoder) to ignore leading Unicode BOM.dart:coreBigInt class added to support integers greater than 64-bits.proxy annotation.Provisional class and provisional field.pragma annotation.RegExp added static escape function.Uri class now correctly handles paths while running on Node.js on
Windows.Iterable added members cast, castFrom, followedBy and whereType.Iterable.singleWhere added orElse parameter.List added + operator, first and last setters, and indexWhere and
lastIndexWhere methods, and static copyRange and writeIterable
methods.Map added fromEntries constructor.Map added addEntries, cast, entries, map, removeWhere, update
and updateAll members.MapEntry: new class used by Map.entries.IterableBase, ListBase, SetBase or
MapBase (or uses the corresponding mixins) from dart:collection, the new
members are implemented automatically.of constructor to List, Set, Map.double.INFINITY, double.NEGATIVE_INFINITY, double.NAN,
double.MAX_FINITE and double.MIN_POSITIVE to double.infinity,
double.negativeInfinity, double.nan, double.maxFinite and
double.minPositive.DateTime to lower case: MONDAY through
SUNDAY, DAYS_PER_WEEK (as daysPerWeek), JANUARY through DECEMBER and
MONTHS_PER_YEAR (as monthsPerYear).Duration to lower case:
MICROSECONDS_PER_MILLISECOND to microsecondsPerMillisecond,
MILLISECONDS_PER_SECOND to millisecondsPerSecond, SECONDS_PER_MINUTE to
secondsPerMinute, MINUTES_PER_HOUR to minutesPerHour, HOURS_PER_DAY to
hoursPerDay, MICROSECONDS_PER_SECOND to microsecondsPerSecond,
MICROSECONDS_PER_MINUTE to microsecondsPerMinute, MICROSECONDS_PER_HOUR
to microsecondsPerHour, MICROSECONDS_PER_DAY to microsecondsPerDay,
MILLISECONDS_PER_MINUTE to millisecondsPerMinute, MILLISECONDS_PER_HOUR
to millisecondsPerHour, MILLISECONDS_PER_DAY to millisecondsPerDay,
SECONDS_PER_HOUR to secondsPerHour, SECONDS_PER_DAY to secondsPerDay,
MINUTES_PER_DAY to minutesPerDay, and ZERO to zero.typeArguments to Invocation class.Invocation
objects directly, without going through noSuchMethod.unaryMinus and empty constant symbols on the Symbol class.UriData.dataAsBytes to Uint8List.tryParse static method to int, double, num, BigInt, Uri and
DateTime.onError parameter on int.parse, double.parse and num.parse.NoSuchMethodError constructor.int.parse on the VM no longer accepts unsigned hexadecimal numbers greater
than or equal to 2**63 when not prefixed by 0x. (SDK issue
32858)dart:developerFlow class added.Timeline.startSync and Timeline.timeSync now accepts an optional parameter
flow of type Flow. The flow parameter is used to generate flow timeline
events that are enclosed by the slice described by
Timeline.{start,finish}Sync and Timeline.timeSync.<!-- Still need entries for all changes to dart:html since 1.x -->
dart:htmlquery and queryAll. Use querySelector and
querySelectorAll.dart:ioHttpStatus added UPGRADE_REQUIRED.IOOverrides and HttpOverrides added to aid in writing tests that wish to
mock varios dart:io objects.Platform.operatingSystemVersion added that gives a platform-specific String
describing the version of the operating system.ProcessStartMode.INHERIT_STDIO added, which allows a child process to
inherit the parent's stdio handles.RawZLibFilter added for low-level access to compression and decompression
routines.SecureSocket, SecurityContext, and X509Certificate
to be consistent across all platforms. All SecureSocket, SecurityContext,
and X509Certificate properties and methods are now supported on iOS and OSX.SecurityContext.alpnSupported deprecated as ALPN is now supported on all
platforms.SecurityContext: added withTrustedRoots named optional parameter
constructor, which defaults to false.timeout parameter to Socket.connect, RawSocket.connect,
SecureSocket.connect and RawSecureSocket.connect. If a connection attempt
takes longer than the duration specified in timeout, a SocketException
will be thrown. Note: if the duration specified in timeout is greater than
the OS level timeout, a timeout may occur sooner than specified in timeout.Stdin.hasTerminal added, which is true if stdin is attached to a terminal.WebSocket added static userAgent property.RandomAccessFile.close returns Future<void>IOOverrides.socketConnect.ZLibOptions, FileMode, FileLock,
FileSystemEntityType, FileSystemEvent, ProcessStartMode,
ProcessSignal, InternetAddressType, InternetAddress, SocketDirection,
SocketOption, RawSocketEvent, and StdioType, and deprecated the old
SCREAMING_CAPS constants.zlib, gzip, and
systemEncoding, and deprecated the old SCREAMING_CAPS top-level constants.FileMode constants READ, WRITE, APPEND,
WRITE_ONLY, and WRITE_ONLY_APPEND. Please use e.g. FileMode.read
instead.X509Certificate.der, X509Certificate.pem, and
X509Certificate.sha1.FileSystemEntity.fromRawPath constructor to allow for the creation of
FileSystemEntity using Uint8List buffers.HttpStatus, HttpHeaders,
ContentType, HttpClient, WebSocketStatus, CompressionOptions, and
WebSocket. The SCREAMING_CAPS constants are marked deprecated. Note that
HttpStatus.CONTINUE is now HttpStatus.continue_, and that e.g.
HttpHeaders.FIELD_NAME is now HttpHeaders.fieldNameHeader.Platform.packageRoot, which is only used for packages/
directory resolution which is no longer supported. It will now always return
null, which is a value that was always possible for it to return previously.HttpClient.connectionTimeout.{Socket,RawSocket,SecureSocket}.startConnect. These return a
ConnectionTask, which can be used to cancel an in-flight connection attempt.dart:isolateIsolate.spawn take a type parameter representing the argument type of
the provided function. This allows functions with arguments types other than
Object in strong mode.IMMEDIATE and BEFORE_NEXT_EVENT on Isolate to immediate and
beforeNextEvent.Isolate.packageRoot, which is only used for packages/ directory
resolution which is no longer supported. It will now always return null, which
is a value that was always possible for it to return previously.packageRoot parameter in Isolate.spawnUri, which is was
previously used only for packages/ directory resolution. That style of
resolution is no longer supported in Dart 2.<!-- Still need entries for all changes to dart:js since 1.x -->
dart.mathE, LN10, LN, LOG2E, LOG10E, PI, SQRT1_2 and SQRT2 to
e, ln10, ln, log2e, log10e, pi, sqrt1_2 and sqrt2.dart.mirrorsIsolateMirror.loadUri, which allows dynamically loading additional
code.MirrorsUsed as deprecated. The MirrorsUsed annotation was only used
to inform the dart2js compiler about how mirrors were used, but dart2js no
longer supports the mirrors library altogether.<!-- Still need entries for all changes to dart:svg since 1.x -->
dart:typed_dataUnmodifiable view classes over all List types.BYTES_PER_ELEMENT to bytesPerElement on all typed data lists.XXXX through WWWW on Float32x4 and Int32x4 to
lower-case xxxx through wwww.Endinanness to Endian and its constants from BIG_ENDIAN,
LITTLE_ENDIAN and HOST_ENDIAN to little, big and host.<!-- Still need entries for all changes to dart:web_audio,web_gl,web_sql since 1.x -->
Support for MIPS has been removed.
Dart int is now restricted to 64 bits. On overflow, arithmetic operations
wrap around, and integer literals larger than 64 bits are not allowed. See
https://github.com/dart-lang/sdk/blob/main/docs/language/informal/int64.md
for details.
The Dart VM no longer attempts to perform packages/ directory resolution
(for loading scripts, and in Isolate.resolveUri). Users relying on
packages/ directories should switch to .packages files.
Expose JavaScript Promise APIs using Dart futures. For example,
BackgroundFetchManager.get is defined as:
Future<BackgroundFetchRegistration> get(String id)
It can be used like:
BackgroundFetchRegistration result = await fetchMgr.get('abc');
The underlying JS Promise-to-Future mechanism will be exposed as a public API in the future.
dartdevc will no longer throw an error from is checks that return a
different result in weak mode (SDK issue 28988). For example:
main() {
List l = [];
// Prints "false", does not throw.
print(l is List<String>);
}
Failed as casts on Iterable<T>, Map<T>, Future<T>, and Stream<T> are
no longer ignored. These failures were ignored to make it easier to migrate
Dart 1 code to strong mode, but ignoring them is a hole in the type system.
This closes part of that hole. (We still need to stop ignoring "as" cast
failures on function types, and implicit cast failures on the above types and
function types.)
dart2js now compiles programs with Dart 2.0 semantics. Apps are expected to be
bigger than before, because Dart 2.0 has many more implicit checks (similar to
the --checked flag in Dart 1.0).
We exposed a --omit-implicit-checks flag which removes most of the extra
implicit checks. Only use this if you have enough test coverage to know that
the app will work well without the checks. If a check would have failed and it
is omitted, your app may crash or behave in unexpected ways. This flag is
similar to --trust-type-annotations in Dart 1.0.
dart2js replaced its front-end with the common front-end (CFE). Thanks to the CFE, dart2js errors are more consistent with all other Dart tools.
dart2js replaced its source-map implementation. There aren't any big differences, but more data is emitted for synthetic code generated by the compiler.
dart:mirrors support was removed. Frameworks are encouraged to use
code-generation instead. Conditional imports indicate that mirrors are not
supported, and any API in the mirrors library will throw at runtime.
The generated output of dart2js can now be run as a webworker.
dart:isolate support was removed. To launch background tasks, please use
webworkers instead. APIs for webworkers can be accessed from dart:html or
JS-interop.
dart2js no longer supports the --package-root flag. This flag was deprecated
in favor of --packages long ago.
The analyzer will no longer issue a warning when a generic type parameter is used as the type in an instance check. For example:
test<T>() {
print(3 is T); // No warning
}
New static checking of @visibleForTesting elements. Accessing a method,
function, class, etc. annotated with @visibleForTesting from a file not in
a test/ directory will result in a new hint (issue 28273).
Static analysis now respects functions annotated with @alwaysThrows (issue
31384).
New hints added:
NULL_AWARE_BEFORE_OPERATOR when an operator is used after a null-aware
access. For example:
x?.a - ''; // HINT
NULL_AWARE_IN_LOGICAL_OPERATOR when an expression with null-aware access
is used as a condition in logical operators. For example:
x.a || x?.b; // HINT
The command line analyzer (dartanalyzer) and the analysis server no longer
treat directories named packages specially. Previously they had ignored
these directories - and their contents - from the point of view of analysis.
Now they'll be treated just as regular directories. This special-casing of
packages directories was to support using symlinks for package: resolution;
that functionality is now handled by .packages files.
New static checking of duplicate shown or hidden names in an export directive (issue 33182).
The analysis server will now only analyze code in Dart 2 mode ('strong mode').
It will emit warnings for analysis options files that have
strong-mode: false set (and will emit a hint for strong-mode: true, which
is no longer necessary).
The dartanalyzer --strong flag is now deprecated and ignored. The
command-line analyzer now only analyzes code in strong mode.
Support assert() in const constructor initializer lists.
Better formatting for multi-line strings in argument lists.
Force splitting an empty block as the then body of an if with an else.
Support metadata annotations on enum cases.
Add --fix to remove unneeded new and const keywords, and change : to
= before named parameter default values.
Change formatting rules around static methods to uniformly format code with
and without new and const.
Format expressions inside string interpolation.
Pub has a brand new version solver! It supports all the same features as the old version solver, but it's much less likely to stall out on difficult package graphs, and it's much clearer about why a solution can't be found when version solving fails.
Remove support for transformers, pub build, and pub serve. Use the [new
build system][transformers] instead.
There is now a default SDK constraint of <2.0.0 for any package with no
existing upper bound. This allows us to move more safely to 2.0.0. All new
packages published on pub will now require an upper bound SDK constraint so
future major releases of Dart don't destabilize the package ecosystem.
All SDK constraint exclusive upper bounds are now treated as though they allow
pre-release versions of that upper bound. For example, the SDK constraint
>=1.8.0 <2.0.0 now allows pre-release SDK versions such as 2.0.0-beta.3.0.
This allows early adopters to try out packages that don't explicitly declare
support for the new version yet. You can disable this functionality by setting
the PUB_ALLOW_PRERELEASE_SDK environment variable to false.
Allow depending on a package in a subdirectory of a Git repository. Git
dependencies may now include a path parameter, indicating that the package
exists in a subdirectory of the Git repository. For example:
dependencies:
foobar:
git:
url: git://github.com/dart-lang/multi_package_repo
path: pkg/foobar
Added an --executables option to pub deps command. This will list all
available executables that can be run with pub run.
The Flutter sdk source will now look for packages in
flutter/bin/cache/pkg/ as well as flutter/packages/. In particular, this
means that packages can depend on the sky_engine package from the sdk
source (issue 1775).
Pub now caches compiled packages and snapshots in the .dart_tool/pub
directory, rather than the .pub directory (issue 1795).
Other bug fixes and improvements.
package:vm_service version 3.0.0+1.Breaking Changes:
LoadStrategy to Dwds.start. This package defines two
compatible load strategies, RequireStrategy and `LegacyStrategy.Dwds.start function signature has been changed to accept one more parameter
of new interface type ExpressionCompiler to support expression evaluationRequireStrategy suitable for use with
package:build_runner.Make the root optional for the ProxyServerAssetReader.
root optional for the ProxyServerAssetReader.Fix an issue where files imported with relative paths containing ../ may fail to resolve breakpoint locations.
../ may
fail to resolve breakpoint locations.package:build_daemon.FrontendServerAssetReader for use with Frontend Server builds.package:sse for handling client reconnects transparently on
the server.Breaking Changes:
BuildResult abstraction from package:build_daemon but
require a similar abstraction provided by this package.AssetHandler has been renamed to AssetReader and no longer provides a
generic resource handler. Specific methods for the required resources are now
clearly defined. The new abstraction is now consumed through dwds.dart.BuildRunnerAssetHandler has been renamed to ProxyServerAssetReader and is
now consumed through dwds.dart.Breaking Change: The AssetHandler will not automatically be added the DWDS handler cascade. You must now also add the middleware to your server's pipe…
middleware and handler.Breaking Change: The AssetHandler will not automatically be added the DWDS
handler cascade. You must now also add the middleware to your server's
pipeline.
Always bind to localhost for the local debug workflow.
localhost for the local debug workflow.Support using WebSockets for the debug (VM Service) proxy by passing useSseForDebugProxy: false to Dwds.start()
useSseForDebugProxy: false to Dwds.start()Support nesting Dart applications in iframes.
Depend on the latest package:built_value.
package:built_value.UrlEncoder will also encode the base URI used by the injected client / Dart Debug Extension. \*\* Breaking Change \*\* serveDevTools is not automatica…
package:sse to get retry logic.serveDevTools is false.UrlEncoder will also encode the base URI used by the injected client / Dart
Debug Extension. ** Breaking Change ** serveDevTools is not
automatically considered true if enableDebugExtensionis true.Properly wait for hot reload to complete with the legacy module system.
getObject for a class with a generic type.Support optional argument urlEncoder that is used to encode remote URLs for use with the Dart Debug Extension.
urlEncoder that is used to encode remote URLs for
use with the Dart Debug Extension.Handle getObject for primitives properly.
Fix issue with source map logic for the legacy module system.
The injected client's connection is now based off the request URI.
ChromeDebugException class for error handling purposes.AppConnectionException class for error handling purposes.pauseBreakpoints on kPauseBreakpoint events.Deobfuscate DDC extension method stack traces.
legacy module system.Correctly set Isolate state if debugging is initiated after the application has already started.
Isolate state if debugging is initiated after the application
has already started.Account for root directory path when using package: URIs with DartUri.
package: URIs with DartUri.Fix a bug where we would try to create a new isolate even for a failed hot restart. This created a race condition that would lead to a crash.
close methods more robust by allowing them to be called more than
once and returning the cached future from previous calls.DWDS.start now requires an AssetHandler instead of applicationPort, assetServerPort and applicationTarget.
DWDS.start now requires an AssetHandler instead of applicationPort,
assetServerPort and applicationTarget.BuildRunnerAssetHandler which proxies request to the asset server
running within build runner.Capture any errors that happen when handling SSE requests in the DevHandler and return an error response to the client code.
Add new required parameter enableDebugging to Dwds.start. If false is provided, debug services will not run. However, reload logic will continue to wo
enableDebugging to Dwds.start. If false is
provided, debug services will not run. However, reload logic will continue to
work with the injected client.Properly set the pauseEvent on the Isolate.
pauseEvent on the Isolate.Fix issue where certain required fields of VM service protocol objects were null.
exceptionPauseMode on the Isolate.DevTools.Fix issue where certain required fields of VM service protocol objects were null.
Fix issue where certain required fields of VM service protocol objects were null.
Closure names in the debug view.Fix an issue where missing source maps would cause a crash. A warning will now be logged to the console instead.
package:webkit_inspection_protocol.Fix an issue where we source map paths were not normalized.
client.js and recommend using the
--no-injected-client flag for webdev users.wsUri to uri on DebugConnection to reflect that the uri may not
be a websocket.package:vm_service.Move data abstractions from package:webdev into package:dwds.
data abstractions from package:webdev into package:dwds.package:webdev into package:dwds.package:webdev into package:dwds.dwds.dart. Existing public API services.dart
is now private.Add support for getScript for paused isolates.
getScript for paused isolates.onRequest and onResponse listeners for the vm service.Add support for scope in evaluate calls.
scope in evaluate calls.Improve error reporting for evals, give the full JS eval in the error message so it can be more easily reproduced.
Change the exposed type on DebugService to VmServiceInterface
- Support setExceptionPauseMode.
setExceptionPauseMode.Treating this as a breaking change because you now must use the wsUri getter to get a valid uri for connecting to the service, when previously combini…
wsUri for increased security.
wsUri
getter to get a valid uri for connecting to the service, when previously
combining the port and host was sufficient.- Initial version
One column per quarter.