Breaking changes and deprecations
This page lists all breaking changes and deprecations in updates to the Dart SDK, organized by release and area, to help Dart developers understand and manage their impact. Complete release notes are available in the Dart SDK changelog. The breaking change policy document describes the policy and process around breaking changes and deprecations in Dart.
This page includes the following types of breaking changes:
- Unversioned
-
The Dart SDK doesn't maintain backward compatibility, and code might break as soon as you upgrade your sdk version if it relies on the previous behavior.
These are the majority of changes and aren't specially marked in this list.
- Language versioned
-
The Dart SDK maintains backward compatibility for existing code, and the behavior change only takes effect (potentially breaking code that relies on the previous behavior) when you upgrade the language version of your code.
These are marked as: Language versioned
- Deprecations
-
The Dart SDK maintains compatibility for deprecated code, with a warning. Deprecations are then completely removed in a later release, breaking any code that relies on the previous behavior.
These are marked as: Deprecated / Removed
- Experimental
-
Part of the release but not yet treated as stable in the SDK and can break from one version to another. Experimental changes don't always have a corresponding breaking change issue, but might have more details in the SDK changelog.
These are marked: Experimental
If you have questions or concerns about any of these breaking changes, please comment on the breaking change issue linked from the relevant entry. To be notified about future breaking changes, join the Dart announce group.
3.10.0
#
Tentative
The following changes are expected to be included in the 3.10 stable release,
but the final list might change before then.
To reduce the potential impact of these changes, consider
accounting for them before the 3.10 release.
Libraries
#dart:io
#
-
IOOverridescan no longer be implemented, but can still be extended.
SDK
#-
The
dartCLI and Dart VM are now separate executables, with the pure Dart VM executable and process calleddartvm. Dart programs should still be run withdart run.
Tools
#-
Subcommands of the
darttool, such asdart formatanddart compilenow run AOT-compiled snapshots of the underlying tools. There should be no functional difference outside of performance improvements, but if you come across incompatibilities, please report them. -
Removed
The
darttool is no longer available for IA32 platforms as the Dart SDK no longer supports IA32.
3.9.0
#Language
#- Language versioned Null safety is now assumed when computing type promotion, reachability, and definite assignment. As a result, improved dead code analysis might cause new analyzer diagnostics to trigger on existing code that previously passed analysis.
Tools
#-
Some subcommands of the
darttool, such asdart analyzeanddart fixnow run AOT-compiled snapshots of the underlying tools. There should be no functional difference outside of performance improvements, but if you come across incompatibilities, please report them.
Pub
#-
Language versioned
The upper bound of the
flutterSDK constraint in your workspace's root package is now respected. If your current SDK doesn't meet the specified bound,dart pub getand other actions that retrieve dependencies will fail.
Dart build
#-
Experimental
Building a CLI app bundle with experimental native asset support now
requires using the
dart build clisubcommand and specifying the app entrypoint with a new--targetoption.
3.8.0
#Libraries
#dart:html
#
-
Removed
The
Element.createdconstructor has been removed. -
Native classes in
dart:html, such asHtmlElement, can no longer be extended.
Tools
#Analyzer
#-
Deprecated
The
avoid_null_checks_in_equality_operatorslint rule is deprecated and should be removed fromanalysis_options.yamlfiles.
Development JavaScript compiler (DDC)
#- Now throws a runtime error when a redirecting factory constructor is torn off and one of its optional non-nullable parameters is provided no value. In the future this is likely to be a compile-time error.
Production JavaScript compiler (dart2js)
#-
Experimental Removed
The
--experiment-new-rtiand--use-old-rtiflags are no longer supported.
Formatter (dart format)
#
- Language versioned The formatter made changes and fixes that result in new output when formatting code with a language version of 3.8 or greater.
3.7.0
#Language
#-
Language versioned Local variables and parameters named
_are now non-binding and can no longer be used or accessed. -
Reachability analysis now accounts for if a field is
type promoted to
Nullusingisoras. This makes the type system more self-consistent, because it mirrors the behavior of promoted local variables. This change isn't expected to make any difference in practice.
Libraries
#
dart:html, dart:indexed:db, dart:svg, dart:web_audo,
dart:web_gl, dart:js
#
-
Deprecated These legacy web libraries are officially deprecated.
They are expected to be removed in a future release.
Project should migrate to use
package:webanddart:js_interop. To learn more, check out Migrate to package:web.
dart:js, dart:js_util, package:js
#
-
Deprecated These legacy JS-interop libraries are officially deprecated.
They are expected to be removed in a future release.
Projects should migrate to use
dart:js_interop. To learn more, check out JS interop usage.
Tools
#Analyzer
#-
Removed The
package_api_docsandunsafe_htmllint rules have been removed and should be removed fromanalysis_options.yamlfiles.
Formatter (dart format)
#
- Language versioned The formatter implements a new style that results in new output when formatting code with a language version of 3.7 or greater.
-
Removed The
--fixflag fordart formatis no longer supported. To apply similar fixes and more, configure your analysis options and rundart fix. -
Deprecated The
--line-lengthoption fordart formathas been deprecated and set to be removed. All usages should be migrated to the new--page-widthoption.
3.6.0
#Language
#-
The context used by Dart to perform type inference on
the operand of a throw expression has been changed from
the "unknown type" to
Object. This makes the type system more self-consistent, because it reflects the fact that it's not legal to thrownull. This change isn't expected to make any difference in practice.
Libraries
#dart:io
#
-
Removed The
Platform()constructor has been removed. All instantiations ofPlatformshould be removed. -
HttpClientnow responds to a redirect that's missing a "Location" header by throwing aRedirectExceptioninstead of aStateError.
Tools
#Analyzer
#-
Deprecated The
package_api_docsandunsafe_htmllint rules have been deprecated and are set to be removed in Dart 3.7.
Compiler front end (cfe)
#- The Dart compiler now computes the upper and lower closures of type schemas just before they're passed into the subtype testing procedure. Before Dart 3.6, the compiler computed them at the very beginning of the upper and lower-bound computations. The analyzer already followed this behavior, so apps that already pass analysis are unlikely to be affected by this change.
Wasm compiler (dart2wasm)
#-
The condition
dart.library.jsis nowfalseon conditional imports when compiling to WebAssembly. Thedart.library.js_interopcondition should be used instead.
Formatter (dart format)
#
The following changes might result in small formatting changes
when running dart format with a Dart 3.6 SDK or later:
-
Preserve type parameters on old-style function-typed formals that
also use
this.orsuper.. - Correctly format imports with both
asandifclauses.
Pub
#-
dart pub publishnow warns if files that are tracked in git have uncommitted changes.
3.5.0
#Language
#-
The context used by the compiler to perform type inference on
the operand of an
awaitexpression has been changed to match the behavior of the analyzer. -
The context used by the compiler to perform type inference on
the right-hand side of an "if-null" expression (
e1 ?? e2) has been changed to match the behavior of the analyzer. The old behavior can be restored by supplying explicit types.
Libraries
#dart:core
#
-
DateTimenow stores microseconds on the web platform, more closely matching the behavior on native platforms.
dart:io
#
dart:js_interop
#
-
importModulenow accepts aJSAnyinstead of aStringto support other JS values as well, such asTrustedScriptURLobjects. -
isTruthyandnotnow returnJSBooleaninstead ofboolto be consistent with other JS operator methods. -
ExternalDartReferenceno longer implementsObject. Instead, it now accepts a type parameter (T) with a bound ofObject?to capture the type of the Dart object that is externalized.
dart:typed_data
#
-
Removed
The unmodifiable view classes for typed data have been removed.
Instead of using the constructors of these classes, use
the new
asUnmodifiableViewmethods on typed data lists.
Runtime
#-
Removed The Dart VM no longer supports unsound null safety.
- The
--no-sound-null-safetyCLI option has been removed. - The
Dart_NewListOfandDart_IsLegacyTypefunctions have been removed from the C API.
- The
-
Removed The
Dart_DefaultCanonicalizeUrlfunction has been removed from the C API.
3.4.0
#Language
#-
The pattern context type schema for cast patterns
is now
_(the unknown type) instead ofObject?. -
The type schema used by the Dart compilers 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.
Libraries
#dart:cli
#
-
Experimental Removed
The
waitForfunction has been removed.
dart:html, dart:indexed:db, dart:svg, dart:web_audo,
dart:web_gl
#
-
Deprecated These libraries are now marked as legacy and
will see less support in the future.
New projects should prefer to use
package:webanddart:js_interop. To learn more, check out Migrate to package:web.
dart:js
#
-
Deprecated
This library is now marked as legacy and will see less support in the future.
Usages should be migrated to
dart:js_interopanddart:js_interop_unsafe. To learn more, check out/go/next-gen-js-interop.
dart:js_util
#
-
Deprecated
This library is now marked as legacy and will see less support in the future.
Usages should be migrated to
dart:js_interopanddart:js_interop_unsafe. To learn more, check out/go/next-gen-js-interop.
dart:io
#
-
Stdouthas a new fieldlineTerminator, which allows developers to control the line ending used bystdoutandstderr. Classes that implementStdoutmust define thelineTerminatorfield. The default semantics ofstdoutandstderrare not changed. -
Deprecated The
FileSystemDeleteEvent.isDirectoryproperty. It always returnsfalse.
dart:typed_data
#
-
Deprecated
The unmodifiable view classes for typed data are deprecated.
Instead of using the constructors of these classes, use
the new
asUnmodifiableViewmethods on typed data lists.
Tools
#Production JavaScript compiler (dart2js)
#-
Experimental Deprecated
You should now specify a format to
the
--dump-infoCLI option of eitherbinaryorjson. Thejsonformat is deprecated and might be removed in a future Dart release.
Wasm compiler (dart2wasm)
#-
Experimental Various
dart compile wasmCLI arguments have been updated, removed, or replaced. To learn more, rundart compile wasm --verbose --help.
Runtime
#-
Removed The Dart VM longer supports external strings.
As a result, the
Dart_IsExternalString,Dart_NewExternalLatin1String, andDart_NewExternalUTF16Stringfunctions have been removed from the Dart C API.
3.3.0
#SDK
#-
Experimental Removed The following experiments are now retired as they were released in Dart 3 and are no longer necessary with a language version of 3.0 or greater. Configuration of them should be removed from analysis options, CLI commands, and IDE configurations.
patternsrecordsclass-modiferssealed-class
Language
#Libraries
#dart:cli
#
-
Experimental Deprecated
The
waitForfunction remains deprecated for another release and is set for removal in Dart 3.4.
dart:ffi
#
-
Deprecated The
elementAtpointer arithmetic methods onPointertypes are deprecated. Migrate to the-and+operators instead. -
Experimental Removed
The previously deprecated
@FfiNativeannotation has been removed. Usages should be updated to use the@Nativeannotation.
dart:html
#
-
Instead of using
HttpRequestdirectly, it is now recommended to usepackage:http.
dart:io
#
-
Instead of using
HttpClientdirectly, it is now recommended to usepackage:http.
dart:js_interop
#
-
Experimental JS types like
JSAnyhave new compiler-specific representation types. -
Experimental User-defined
@staticInteropclasses can no longer implementJSAnyorJSObject. Usages should be migrated toJSObject.fromInteropObjector be defined as extension types. -
Experimental
JSArrayandJSPromisenow have generic parameters. -
Experimental Various extension members were moved or renamed.
To learn about the updated extensions, reference
JSAnyUtilityExtensionandJSAnyOperatorExtension.
dart:typed_data
#
-
The unmodifiable view classes for typed data will
be deprecated in Dart 3.4.
Instead of using the constructors of these classes, use
the new
asUnmodifiableViewmethods on typed data lists.
dart:nativewrappers
#
-
Experimental All native wrapper classes are now marked
baseso that none of their subtypes can be implemented.
Tools
#Production JavaScript compiler (dart2js)
#-
The
Invocationthat is passed tonoSuchMethodno longer has a minifiedmemberName, even when compiled with--minify.
Wasm compiler (dart2wasm)
#-
Experimental Disallow importing legacy JS interop libraries.
Prefer using
dart:js_interopanddart:js_interop_unsafeinstead.
Analyzer
#-
Experimental Invalid
dart doccomment directives are now reported by the analyzer. -
Due to improvements in type promotion, the following analyzer diagnostics might trigger on existing code that previously passed analysis:
unnecessary_non_null_assertionunnecessary_castinvalid_null_aware_operator
Linter
#-
The
iterable_contains_unrelated_typeandlist_remove_unrelated_typelints were removed. Consider migrating to the expandedcollection_methods_unrelated_typelint. -
The following lints are removed due to no longer being necessary with sound null safety. You should remove configuration of them from your
analysis_options.yamlfiles and any ignore comments.always_require_non_null_named_parametersavoid_returning_nullavoid_returning_null_for_future
3.2.0
#Language
#- Language versioned Changed the split point for refutable patterns to the top level pattern so type promotion in if-case statements is consistent regardless of whether the scrutinee might throw an exception.
Libraries
#dart:cli
#
-
Experimental Deprecated
The
waitForfunction.
dart:convert
#
-
Changed return types of
utf8.encode()andUtf8Codec.encode()fromList<int>toUint8List.
dart:developer
#
-
Deprecated The
Service.getIsolateIDmethod.
dart:ffi
#
-
Changed
NativeCallable.nativeFunctionso calls now throw an error if the receiver is already closed, instead of returningnullptr.
dart:io
#
- Eliminated trailing whitespace from HTTP headers.
-
Inserted a space at the fold point of folded header values
that
HttpClientResponse.headersandHttpRequest.headersreturn.
dart:js_interop
#
-
Experimental Removed
JSNumber.toDartin favor oftoDartDoubleandtoDartInt. -
Experimental Removed
Object.toJSin favor ofObject.toJSBox. -
Experimental Restricted external JS interop APIs using
dart:js_interopto a set of allowed types. -
Experimental Prohibited use of
isNullandisUndefinedon dart2wasm. -
Experimental Changed
typeofEqualsandinstanceofAPIs to both return bool instead ofJSBoolean. Also,typeofEqualsnow takesStringinstead ofJSString. -
Experimental Changed
JSAnyandJSObjecttypes to only implementable, not extendable, by user@staticInteroptypes. -
Experimental Changed
JSArray.withLengthto takeintinstead ofJSNumber.
Tools
#Development JavaScript compiler (DDC)
#-
Added interceptors for JavaScript
SymbolandBigInttypes; they should no longer be used withpackage:jsclasses.
Production JavaScript compiler (dart2js)
#-
Added interceptors for JavaScript
SymbolandBigInttypes; they should no longer be used withpackage:jsclasses.
Analyzer
#-
Language versioned Private final field promotion might cause the following analyzer warnings to trigger on existing code that previously passed analysis:
dartclass C { final num? _x = null; ​ void test() { if (_x != null) { print(_x! * 2); // unnecessary_non_null_assertion print(_x?.abs()); // invalid_null_aware_operator } if (_x is int) { print((_x as int).bitLength); // unnecessary_cast } } }
3.1.0
#Libraries
#dart:async
#
-
Added
interfacemodifier to purely abstract classes:MultiStreamController,StreamConsumer,StreamIteratorandStreamTransformer.
dart:io
#
-
Added
sameSiteto theCookieclass, and added the classSameSite. -
FileSystemEventissealed. This meansFileSystemEventcannot be extended or implemented.
dart:js_interop
#
-
Experimental Removed
ObjectLiteral; create an object literal with no named members using{}.jsify().
package:js
#
-
external@staticInteropmembers andexternalextension members can no longer be used as tear-offs. Declare a closure or a non-externalmethod that calls these members, and use that instead. -
external@staticInteropmembers andexternalextension members will generate slightly different JS code for methods that have optional parameters.
3.0.0
#Language
#-
Language versioned Changed interpretation of switch cases from constant expressions to patterns.
-
Language versioned Class declarations from libraries that have been upgraded to Dart 3.0 can no longer be used as mixins by default.
-
Dart reports a compile-time error if a
continuestatement targets a label that is not a loop (for,doandwhilestatements) or aswitchmember.
Libraries
#-
The following existing classes have been made mixin classes:
Iterable,IterableMixin,IterableBase,ListMixin,SetMixin,MapMixin,LinkedListEntry,StringConversionSink.
dart:core
#
- Deprecated Deprecated APIs.
dart:async
#
-
Removed Removed the deprecated
DeferredLibraryclass.
dart:collection
#
- Language versioned Changes to platform libraries.
dart:developer
#
-
Removed Removed the deprecated
MAX_USER_TAGSconstant. UsemaxUserTagsinstead. -
Removed Removed the deprecated
Metrics,Metric,Counter, andGaugeclasses as they have been broken since Dart 2.0.
dart:ffi
#
-
Experimental Deprecated
The
@FfiNativeannotation is now deprecated. Usages should be updated to use the@Nativeannotation.
dart:html
#
-
Removed Removed the deprecated
registerElementandregisterElement2methods inDocumentandHtmlDocument.
dart:math
#
-
Language versioned The
Randominterface can only be implemented, not extended.
dart:io
#
-
Updated
NetworkProfilingto accommodate newStringids that are introduced in vm_service:11.0.0
2.19.0
#Language
#-
Flagged additional code as unreachable due to types
NullandNever. -
Don't delegate inaccessible private names to
noSuchMethod. - Report a compile-time error for all cyclic dependencies during top-level type inference.
Libraries
#dart:convert
#
-
Removed The previously deprecated API
[
DEFAULT_BUFFER_SIZE] inJsonUtf8Encoderhas been removed.
dart:developer
#
-
Removed Removed previously deprecated APIs
kInvalidParams,kExtensionError,kExtensionErrorMax, andkExtensionErrorMininServiceExtensionResponse.
dart:ffi
#
-
Changed the runtime type argument of
PointertoNeverin preparation of completely removing the runtime type argument. ChangedPointer.toStringto not report any type argument.
dart:io
#
- Disallow negative or hexadecimal content-length headers.
-
File.createnow takes new optionalexclusiveboolparameter, and when it istruethe operation will fail if target file already exists. -
Calling
ResourceHandle.toFile(),ResourceHandle.toSocket(),ResourceHandle.toRawSocket()orResourceHandle.toRawDatagramSocket(), more than once now throws aStateError.
dart:isolate
#
-
Reverted
SendPort.sendback to strict checks on contents of messages when sending messages between isolates that are not known to share the same code.
dart:mirrors
#
-
Removed Removed APIs
MirrorsUsedandComment.
package:js
#
-
Breaking changes to the preview feature
@staticInterop:- Disallowed classes with this annotation from using
externalgenerative constructors. See 48730 and 49941 for more details. - Disallowed classes with this annotation's external extension members from using type parameters.
- Classes with this annotation should also have the
@JSannotation. - Classes with this annotation can not be implemented by classes without this annotation.
- Disallowed classes with this annotation from using
dart2js
#
2.18.0
#Language
#Libraries
#dart:io
#
-
Changed the
uriproperty ofRedirectExceptionindart:ioto be nullable. -
Removed constants in
dart:ionetworking APIs following theSCREAMING_CAPSconvention. - The Dart VM no longer automatically restores the initial terminal settings upon exit.
Tools
#Dart command line
#2.17.0
#Libraries
#dart:io
#
-
Added new
connectionFactoryproperty toHttpClient. -
Added new
keyLogproperty toHttpClient, which allows TLS keys to be logged for debugging purposes. -
Removed constants in
dart:iofollowing theSCREAMING_CAPS -
Added a new
allowLegacyUnsafeRenegotiationproperty toSecurityContext, which allows TLS renegotiation for client secure sockets.
Tools
#Dart command line
#-
Deprecated Deprecated the standalone
dart2jstool. -
Deprecated Deprecated the standalone
dartdevctool. -
Removed Removed the standalone
dartdoctool.
2.16.0
#Libraries
#dart:io
#
-
On Windows,
Directory.renamewill no longer delete a directory ifnewPathspecifies one. Instead, aFileSystemExceptionwill be thrown. -
Removed Removed the
Platform.packageRootAPI.
dart:isolate
#
-
Removed Removed the
Isolate.packageRootAPI.
Tools
#Dart command line
#-
Deprecated Deprecated the standalone
dartanalyzertool. -
Deprecated Deprecated the standalone
dartdoctool. -
Removed Removed the deprecated standalone
pubtool.
2.15.0
#Libraries
#dart:io
#
-
Updated the
SecurityContextclass to set the minimum TLS protocol version to TLS1_2_VERSION (1.2) instead of TLS1_VERSION.
dart:web_sql
#
dart:html
#
-
Removed
window.openDatabase(related todart:web_sqldeletion above).
Tools
#Dart command line
#-
Removed the standalone
dart2nativetool. - Removed the standalone
dartfmttool.
Dart VM
#-
Removed support for
dart-ext:-style native extensions -
Grouped isolates spawned via the
Isolate.spawn()API to operate on the same managed heap, and therefore share various VM-internal data structures.
2.14.0
#Libraries
#dart:io
#
-
The setter callbacks
.authenticateand.authenticateProxyinHttpClientmust now accept a nullablerealmargument (for pre-migrated null safe code).
dart:typed_data
#
- Most types exposed by this library can no longer be extended, implemented or mixed-in.
Tools
#Dart VM
#-
Expandos, and the
objectparameters ofDart_NewWeakPersistentHandleandDart_NewFinalizableHandle, no longer acceptPointerand subtypes ofStruct
Dart command line
#-
Deprecated the standalone
dart2nativetool - Deprecated the standalone
dartfmttool.
dart2js
#
-
dart2jsno longer supports legacy browsers, because it emits ES6+ JavaScript by default.
Dart Dev Compiler (DDC)
#-
Changed subtyping relations of
package:jsclasses to be more correct and consistent with Dart2JS.
2.13.0
#Libraries
#package:js
#
-
No longer valid to use a
Stringthat matches an@Nativeannotation in an@JS()annotation for a non-anonymous JS interop class.
2.12.0
#Language
#- Null safety is now enabled by default in all code that has not opted out.
-
Fixed an implementation bug where
thiswould sometimes undergo type promotion in extensions.
Libraries
#dart:ffi
#
-
Deprecated invocations with a generic
TofsizeOf<T>,Pointer<T>.elementAt(),Pointer<T extends Struct>.ref, andPointer<T extends Struct>[] -
Deprecated
allocateinpackage:ffi, as it will no longer be able to invokesizeOf<T>generically. -
Deprecated subtypes of
Structwithout any native member.
Tools
#Dart VM
#-
Dart_WeakPersistentHandleno longer auto-deletes itself when the referenced object is garbage collected to avoid race conditions. -
Renamed
Dart_WeakPersistentHandleFinalizertoDart_HandleFinalizerand removed itshandleargument.
Pub
#2.10.0
#Tools
#Dart VM
#-
Renamed
dart_api_dl.cctodart_api_dl.cand changed to a pure C file.
2.9.0
#Libraries
#dart:convert
#
-
When encoding a string containing unpaired surrogates as UTF-8, the unpaired
surrogates will be encoded as replacement characters (
U+FFFD). - When decoding UTF-8, encoded surrogates will be treated as malformed input.
-
Changed the number of replacement characters emitted
for malformed
input sequences to match the WHATWG encoding standard
when decoding UTF-8
with
allowMalformed: true.
dart:html
#
-
CssClassSet.add()andCssClassSet.togglenow returnfalseinstead ofnullif theCssClassSetcorresponds to multiple elements.
dart:mirrors
#
-
Web compilers (dart2js and DDC) now produce a compile-time error
if
dart:mirrorsis imported.
Tools
#Dart VM
#-
When printing a string using the
printfunction, the default implementation will print any unpaired surrogates in the string as replacement characters (U+FFFD). -
The
Dart_StringToUTF8function in the Dart API will convert unpaired surrogates into replacement characters.
2.8.1
#Language
#- Fixed an implementation bug where local variable inference would incorrectly use the promoted type of a type variable.
-
Fixed an implementation bug surrounding the clauses
implements Function,extends Function, orwith Functionno longer having an effect since Dart 2.0.0.
Libraries
#dart:async
#
-
Changed the return type of
StreamSubscription.cancel()toFuture<void>. -
Split the
runZoned()function into two functions:runZoned()andrunZonedGuarded(), where the latter has a requiredonErrorparameter, and the former has none. -
Errors passed to
Completer.completeError(),Stream.addError(),Future.error(), etc. can no longer benull. - Made stack traces non-null .
dart:core
#
-
Three members on
RuneIteratorno longer returnnullwhen accessed before the first call tomoveNext(). -
The
String.fromEnvironment()default value fordefaultValueis now an empty string instead ofnull. -
The default value for
int.fromEnvironment()'sdefaultValueparameter is now zero.
dart:ffi
#
-
Changed
Pointer.asFunction()andDynamicLibrary.lookupFunction()to extension methods.
dart:io
#
-
Changed the signature of
HttpHeadersmethodsadd()andset. -
The
Socketclass now throws aSocketExceptionif the socket has been explicitly destroyed or upgraded to a secure socket upon setting or getting socket options. -
The
Processclass now throws aStateErrorif the process is detached (ProcessStartMode.detachedandProcessStartMode.detachedWithStdio) upon accessing theexitCodegetter. -
The
Processclass now also throws when not connected to the child process's stdio (ProcessStartMode.detachedandProcessStartMode.inheritStdio) upon accessing thestdin,stdout, andstderrgetters. -
The dummy object returned if
FileStat.stat()orFileStat.statSync()fail now contains Unix epoch timestamps instead ofnullfor theaccessed,changed, andmodifiedgetters. -
The
HeaderValueclass now parses more strictly in two invalid edge cases.
Tools
#Dart Dev Compiler (DDC)
#We fixed several inconsistencies between DDC and Dart2JS so that users less frequently encounter code that is accepted by one compiler but then fails in the other.
- Deleted the legacy (analyzer based) version of DDC.
-
Functions passed to JavaScript using the recommended
package:jsinterop specification must now be wrapped with a call toallowInterop. - Constructors in
@JS()classes must be marked withexternal.
dart2js
#
- 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.
- Types are now normalized.
- Constructors in
@JS()classes must be marked withexternal. -
Completely removed the
--package-rootflag, which was hidden and disabled in Dart 2.0.0.
2.7.1
#2.7.0
#Language
#Libraries
#dart:io
#
-
Added
IOOverrides.serverSocketBindto aid in writing tests that wish to mockServerSocket.bind.
2.6.0
#Language
#-
Changed inference when using
Nullvalues in aFutureOrcontext. Namely, constraints of the forms similar toNull<:FutureOr<T>now yieldNullas the solution forT.
Libraries
#dart:ffi
#
- The API now makes use of static extension members.
- Removed memory management
Pointer.allocateandPointer.free. Pointer.offsetBywas removed, usecastandelementAtinstead.
2.5.0
#Libraries
#-
Various methods and properties across various core libraries, which used
to declare a return type of
List<int>, were updated to declare a return type ofUint8List.
dart:io
#
-
The
Cookieclass's constructor'snameandvalueoptional positional parameters are now mandatory. -
The
Cookieclass'snameandvaluesetters now validate that the strings are made from the allowed character set and are not null.
Tools
#Pub
#- Packages published to pub.dev can no longer contain git dependencies.
2.4.0
#Language
#Libraries
#dart:isolate
#
-
Isolate.resolvePackageUriwill always throw anUnsupportedErrorwhen compiled with dart2js or DDC.
dart:async
#
-
Fixed a bug in the
StreamIteratorclass whereawait forallowednullas a stream.
2.2.0
#Libraries
#package:kernel
#
-
The
klassgetter on theInstanceConstantclass in the Kernel AST API has been renamed toclassNodefor consistency. -
Updated
Linkimplementation to utilize true symbolic links instead of junctions on Windows.
2.1.1
#Libraries
#dart:io
#
Tools
#Dart VM
#-
Fixed a soundness hole when using
dart:mirrorsto reflectively invoke a method in an incorrect way that violates its static types.
2.1.0
#Language
#-
A number of static errors that should have been detected
and reported were not supported in 2.0.0. These are reported now, which means
existing incorrect code might show new errors:
- Mixins must correctly override their superclasses.
- Implicit type arguments in extends clauses must satisfy the class bounds.
- Instance members should shadow prefixes.
- Constructor invocations must use valid syntax, even with optional
new. - Type arguments to generic typedefs must satisfy their bounds.
- Classes can't implement FutureOr.
- Abstract methods may not unsoundly override a concrete method.
- Constant constructors cannot redirect to non-constant constructors.
- Setters with the same name as the enclosing class aren't allowed.
Tools
#dart2js
#
- Duplicate keys in a const map are not allowed and produce a compile-time error.
2.0.0
#Language
#- Replaced the unsound optional static type system with a sound static type system using type inference and runtime checks, formerly called strong mode.
-
Functions marked
asyncnow run synchronously until the firstawaitstatement.
Libraries
#-
Renamed constants in the core libraries from
SCREAMING_CAPStolowerCamelCase. - Added many new methods to core library classes that will need to be implemented if you implement the interfaces of these classes.
-
dart:isolateanddart:mirrorsare no longer supported when using Dart for the web.
Tools
#Pub
#- Replaced pub's transformer-based build system with a new build system.
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-22. View source or report an issue.