dart:core- Temporarily disabled the
whereTypemethod until generic methods are enabled on all platforms (issue 32463). - Changed return type of
UriData.dataAsBytestoUint8List.
- Temporarily disabled the
dart:convert- Added
jsonEncode,jsonDecode,base64Encode,base64UrlEncodeandbase64Decodetop-level functions. - Changed return type of
encodeonAsciiCodecandLatin1Codec, andconvertonAsciiEncoder,Latin1Encoder, toUint8List.
- Added
-
dart2js
-
The dart2js compiler now uses the common front-end by default. This is a step towards supporting Dart 2.0. At this time dart2js has no semantic changes: the Dart 2.0 strong-mode semantics are not enabled, so dart2js continues to support the Dart 1 type system. This change however lets us start supporting new syntactic features of Dart 2.0, like optional new/const. With this change you may notice:
-
small code differences (~1% code size): some code is generated slightly different, this is expected because the internal representation of the program has small differences between the old and new front end.
-
source-maps changes: with the new front-end, dart2js also is using a new mechanism to generate source-map files. We don't expect big differences here either, the new source-maps try to encode more data for locations that are commonly used during debugging.
-
some missing errors: the CFE is not complete and may not report some static errors that the old front-end did. This is temporary. If you run the analyzer on all your project already, you may never notice those missing error messages.
-
as announced earlier, this is the first version of dart2js that no longer supports
dart:mirrors. -
this is the first version of dart2js that no longer supports
--package-root, which long ago was deprecated in favor of--packages.
-
-
- A string in a
part ofdeclaration may now be used to refer to the library this file is part of. A library part can now declare its library either as:part of name.of.library;or aspart 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. - Added support for starting
asyncfunctions synchronously. All tools (VM, dart2js, DDC) have now a flag--sync-asyncto enable this behavior. Currently this behavior is opt-in. It will become the default. - The type
voidis now a Top type likedynamic, andObject. 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 will now have an error on the assignment to
y.test() { Future<int> f; var x = f.then<Future<List<int>>>((x) => []); Future<List<int>> y = x; }
-
dart:asyncStream:- Added
cast,castFrom, andretype. - Changed
firstWhere,lastWhere, andsingleWhereto returnFuture<T>and added an optionalT orElse()callback.
- Added
StreamTransformer: addedcast,castFrom,retype.StreamTransformerBase: new class.Timer: addedtickproperty.Zone- changed to be strong-mode clean. This required some breaking API changes. See https://goo.gl/y9mW2x for more information.
- Added
bindBinaryCallbackGuarded,bindCallbackGuarded, andbindUnaryCallbackGuarded. - Renamed
Zone.ROOTtoZone.root.
-
dart:cli-
New "provisional" library for CLI-specific features.
-
waitFor: function that suspends a stack to wait for aFutureto complete.
-
-
dart:collectionMapBase: addedmapToString.LinkedHashMapno longer implementsHashMapLinkedHashSetno longer implementsHashSet.- Added
ofconstructor toQueue,ListQueue,DoubleLinkedQueue,HashSet,LinkedHashSet,SplayTreeSet,Map,HashMap,LinkedHashMap,SplayTreeMap.
-
dart:convertBase64Codec.decodereturn type is nowUint8List.JsonUnsupportedObjectError: addedpartialResultpropertyLineSplitternow implementsStreamTransformer<String, String>instead ofConverter. It retainsConvertermethodsconvertandstartChunkedConversion.Utf8Decoderwhen compiled with dart2js uses the browser'sTextDecoderin some common cases for faster decoding.- Renamed
ASCII,BASE64,BASE64URI,JSON,LATIN1andUTF8toascii,base64,base64Uri,json,latin1andutf8. - Renamed the
HtmlEscapeModeconstantsUNKNOWN,ATTRIBUTE,SQ_ATTRIBUTEandELEMENTtounknown,attribute,sqAttributeandelements.
-
dart:coreBigIntclass added to support integers greater than 64-bits.- Deprecated the
proxyannotation. - Added
Provisionalclass andprovisionalfield. - Added
pragmaannotation. RegExpadded staticescapefunction.- The
Uriclass now correctly handles paths while running on Node.js on Windows. - Core collection changes
Iterableadded memberscast,castFrom,followedBy,retypeandwhereType.Iterable.singleWhereaddedorElseparameter.Listadded+operator,firstandlastsetters, andindexWhereandlastIndexWheremethods, and staticcopyRangeandwriteIterablemethods.MapaddedfromEntriesconstructor.MapaddedaddEntries,cast,entries,map,removeWhere,retype,updateandupdateAllmembers.MapEntry: new class used byMap.entries.- Note: if a class extends
IterableBase,ListBase,SetBaseorMapBase(or uses the corresponding mixins) fromdart:collection, the new members are implemented automatically. - Added
ofconstructor toList,Set,Map.
- Renamed
double.INFINITY,double.NEGATIVE_INFINITY,double.NAN,double.MAX_FINITEanddouble.MIN_POSITIVEtodouble.infinity,double.negativeInfinity,double.nan,double.maxFiniteanddouble.minPositive. - Renamed the following constants in
DateTimeto lower case:MONDAYthroughSUNDAY,DAYS_PER_WEEK(asdaysPerWeek),JANUARYthroughDECEMBERandMONTHS_PER_YEAR(asmonthsPerYear). - Renamed the following constants in
Durationto lower case:MICROSECONDS_PER_MILLISECONDtomicrosecondsPerMillisecond,MILLISECONDS_PER_SECONDtomillisecondsPerSecond,SECONDS_PER_MINUTEtosecondsPerMinute,MINUTES_PER_HOURtominutesPerHour,HOURS_PER_DAYtohoursPerDay,MICROSECONDS_PER_SECONDtomicrosecondsPerSecond,MICROSECONDS_PER_MINUTEtomicrosecondsPerMinute,MICROSECONDS_PER_HOURtomicrosecondsPerHour,MICROSECONDS_PER_DAYtomicrosecondsPerDay,MILLISECONDS_PER_MINUTEtomillisecondsPerMinute,MILLISECONDS_PER_HOURtomillisecondsPerHour,MILLISECONDS_PER_DAYtomillisecondsPerDay,SECONDS_PER_HOURtosecondsPerHour,SECONDS_PER_DAYtosecondsPerDay,MINUTES_PER_DAYtominutesPerDay, andZEROtozero. - Added
typeArgumentstoInvocationclass. - Added constructors to invocation class that allows creation of
Invocationobjects directly, without going throughnoSuchMethod. - Added
unaryMinusandemptyconstant symbols on theSymbolclass.
-
dart:developerFlowclass added.Timeline.startSyncandTimeline.timeSyncnow accept an optional parameterflowof typeFlow. Theflowparameter is used to generate flow timeline events that are enclosed by the slice described byTimeline.{start,finish}SyncandTimeline.timeSync.
-
dart:ioHttpStatusaddedUPGRADE_REQUIRED.IOOverridesandHttpOverridesadded to aid in writing tests that wish to mock variosdart:ioobjects.Platform.operatingSystemVersionadded that gives a platform-specific String describing the version of the operating system.ProcessStartMode.INHERIT_STDIOadded, which allows a child process to inherit the parent's stdio handles.RawZLibFilteradded for low-level access to compression and decompression routines.- Unified backends for
SecureSocket,SecurityContext, andX509Certificateto be consistent across all platforms. AllSecureSocket,SecurityContext, andX509Certificateproperties and methods are now supported on iOS and OSX. SecurityContext.alpnSupporteddeprecated as ALPN is now supported on all platforms.SecurityContext: addedwithTrustedRootsnamed optional parameter constructor, which defaults to false.- Added a
timeoutparameter toSocket.connect,RawSocket.connect,SecureSocket.connectandRawSecureSocket.connect. If a connection attempt takes longer than the duration specified intimeout, aSocketExceptionwill be thrown. Note: if the duration specified intimeoutis greater than the OS level timeout, a timeout may occur sooner than specified intimeout. Stdin.hasTerminaladded, which is true if stdin is attached to a terminal.WebSocketadded staticuserAgentproperty.
-
dart:isolate- Make
Isolate.spawntake a type parameter representing the argument type of the provided function. This allows functions with arguments types other thanObjectin strong mode. - Rename
IMMEDIATEandBEFORE_NEXT_EVENTonIsolatetoimmediateandbeforeNextEvent.
- Make
-
dart.math- Renamed
E,LN10,LN,LOG2E,LOG10E,PI,SQRT1_2andSQRT2toe,ln10,ln,log2e,log10e,pi,sqrt1_2andsqrt2.
- Renamed
-
dart:typed_data- Added
Unmodifiableview classes over allListtypes. - Renamed
BYTES_PER_ELEMENTtobytesPerElementon all typed data lists. - Renamed constants
XXXXthroughWWWWonFloat32x4andInt32x4to lower-casexxxxthroughwwww. - Renamed
EndinannesstoEndianand its constants fromBIG_ENDIAN,LITTLE_ENDIANandHOST_ENDIANtolittle,bigandhost.
- Added
-
Support for MIPS has been removed.
-
Dart
intis 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/master/docs/language/informal/int64.md for details.
-
Analyzer
-
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
@visibleForTestingelements. Accessing a method, function, class, etc. annotated with@visibleForTestingfrom a file not in atest/directory will result in a new hint (issue 28273). -
Static analysis now respects functions annotated with
@alwaysThrows(issue 31384).
-
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.
-
Git dependencies may now include a
pathparameter, 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
--executablesoption topub depscommand. This will list all available executables that can be run withpub run. -
Added a
PUB_MAX_WORKERS_PER_TASKenvironment variable which can be set to configure the number of dartdevc/analyzer workers that are used when compiling with--web-compiler=dartdevc. -
The Flutter
sdksource will now look for packages influtter/bin/cache/pkg/as well asflutter/packages/. In particular, this means that packages can depend on thesky_enginepackage from thesdksource (issue 1775). -
Pub will now automatically retry HTTP requests that fail with a 502, 503, of 504 error code (issue 1556).
-
Pub now caches compiled packages and snapshots in the
.dart_tool/pubdirectory, rather than the.pubdirectory (issue 1795). -
Emit exit code 66 when a path dependency doesn't exist (issue 1747).
-
pub publishthrows a more explicit error if thepublish_tofield isn't an absolute URL (issue 1769). -
pub publishprovides more detailed information if the package is too large to upload.
-
Added a
--build-delayargument topub servewhich sets the amount of time (in ms) to wait between file watcher events before scheduling a build. Defaults to 50. -
pub getandpub upgradeproperly produce an error message and exit code when no network is present. -
pub servenow waits for file watcher events to stabilize before scheduling new builds. This helps specifically withsafe-writefeatures in editors, as well as other situations such assave allwhich cause many fast edits. -
Removed the require.js module loading timeout for dartdevc, which resolves an issue where the initial load of an app might give a timeout error.
-
Root package analysis options are no longer enforced for dependencies when compiling with dartdevc (issue 1684).
-
Dart scripts can be included from subdirectories with dartdevc (issue 30246).
-
The
barbackinfrastructure now supportsasync2.0.0. -
Print a more informative error message when the Flutter SDK isn't available (issue 1719).
-
Don't crash when publishing a package that contains an empty submodule (issue 1679).
-
Emit exit code 69 for TLS errors (issue 1729).
-
Fix
pub global runfor packages activated from a local path that also have relative path dependencies (issue 1751). -
pub buildandpub servesupport using the common front-end in the dart2js transformer.
-
dartfmt
- Support assert in const constructor initializer lists.
- Better formatting for multi-line strings in argument lists. wasn't in a Git repository.
-
Dart Dev Compiler
- dartdevc will no longer throw an error from
ischecks 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>); }
- dartdevc will no longer throw an error from
- Fix for constructing a new SecurityContext that contains the built-in certificate authority roots (issue 24693).
dart:io- Unified backends for
SecureSocket,SecurityContext, andX509Certificateto be consistent across all platforms. AllSecureSocket,SecurityContext, andX509Certificateproperties and methods are now supported on iOS and OSX.
- Unified backends for
- Fixes for debugging in Dartium.
- Fix DevConsole crash with JS (issue 29873).
- Fix debugging in WebStorm, NULL returned for JS objects (issue 29854).
- Bug fixes for dartdevc support in
pub serve.- Fixed module config invalidation logic so modules are properly recalculated when package layout changes.
- Fixed exception when handling require.js errors that aren't script load errors.
- Fixed an issue where requesting the bootstrap.js file before the dart.js file would result in a 404.
- Fixed a Safari issue during bootstrapping (note that Safari is still not officially supported but does work for trivial examples).
- Fix for a Dartium issue where there was no sound in checked mode (issue 29810).
-
During a dynamic type check,
voidis not required to benullanymore. In practice, this makes overridingvoidfunctions with non-voidfunctions safer. -
During static analysis, a function or setter declared using
=>with return typevoidnow allows the returned expression to have any type. For example, assuming the declarationint x;, it is now type correct to havevoid f() => ++x;. -
A new function-type syntax has been added to the language. Warning: In Dart 1.24, this feature is incomplete, and not stable in the Analyzer.
Intuitively, the type of a function can be constructed by textually replacing the function's name with
Functionin its declaration. For instance, the type ofvoid foo() {}would bevoid Function(). The new syntax may be used wherever a type can be written. It is thus now possible to declare fields containing functions without needing to write typedefs:void Function() x;. The new function type has one restriction: it may not contain the old-style function-type syntax for its parameters. The following is thus illegal:void Function(int f()).typedefshave been updated to support this new syntax.Examples:
typedef F = void Function(); // F is the name for a `void` callback. int Function(int) f; // A field `f` that contains an int->int function. class A<T> { // The parameter `callback` is a function that takes a `T` and returns // `void`. void forEach(void Function(T) callback); } // The new function type supports generic arguments. typedef Invoker = T Function<T>(T Function() callback);
-
dart:async,dart:core,dart:io- Adding to a closed sink, including
IOSink, is no longer not allowed. In 1.24, violations are only reported (on stdout or stderr), but a future version of the Dart SDK will change this to throwing aStateError.
- Adding to a closed sink, including
-
dart:convert- BREAKING Removed the deprecated
ChunkedConverterclass. - JSON maps are now typed as
Map<String, dynamic>instead ofMap<dynamic, dynamic>. A JSON-map is not aHashMaporLinkedHashMapanymore (but just aMap).
- BREAKING Removed the deprecated
-
dart:io- Added
Platform.localeName, needed for accessing the locale on platforms that don't store it in an environment variable. - Added
ProcessInfo.currentRssandProcessInfo.maxRssfor inspecting the Dart VM process current and peak resident set size. - Added
RawSynchronousSocket, a basic synchronous socket implementation.
- Added
-
dart:web APIs have been updated to align with Chrome v50. This change includes a large number of changes, many of which are breaking. In some cases, new class names may conflict with names that exist in existing code. -
dart:html-
REMOVED classes:
Bluetooth,BluetoothDevice,BluetoothGattCharacteristic,BluetoothGattRemoteServer,BluetoothGattService,BluetoothUuid,CrossOriginConnectEvent,DefaultSessionStartEvent,DomSettableTokenList,MediaKeyError,PeriodicSyncEvent,PluginPlaceholderElement,ReadableStream,StashedMessagePort,SyncRegistration -
REMOVED members:
texImage2DCanvaswas removed fromRenderingContext.endClipandstartClipwere removed fromAnimation.afterandbeforewere removed fromCharacterData,ChildNodeandElement.keyLocationwas removed fromKeyboardEvent. Uselocationinstead.generateKeyRequest,keyAddedEvent,keyErrorEvent,keyMessageEvent,mediaGroup,needKeyEvent,onKeyAdded,onKeyError,onKeyMessage, andonNeedKeywere removed fromMediaElement.getStorageUpdateswas removed fromNavigatorstatuswas removed fromPermissionStatusgetAvailabilitywas removed fromPreElement
-
Other behavior changes:
- URLs returned in CSS or html are formatted with quoted string.
Like
url("http://google.com")instead ofurl(http://google.com). - Event timestamp property type changed from
inttonum. - Chrome introduced slight layout changes of UI objects.
In addition many height/width dimensions are returned in subpixel values
(
numinstead of whole numbers). setRangeTextwith aselectionModevalue of 'invalid' is no longer valid. Only "select", "start", "end", "preserve" are allowed.
- URLs returned in CSS or html are formatted with quoted string.
Like
-
-
dart:svg- A large number of additions and removals. Review your use of
dart:svgcarefully.
- A large number of additions and removals. Review your use of
-
dart:web_audio- new method on
AudioContext–createIirFilterreturns a new classIirFilterNode.
- new method on
-
dart:web_gl-
new classes:
CompressedTextureAstc,ExtColorBufferFloat,ExtDisjointTimerQuery, andTimerQueryExt. -
ExtFragDepthadded:readPixels2andtexImage2D2.
-
-
Removed ad hoc
Future.theninference in favor of usingFutureOr. Prior to addingFutureOrto the language, the analyzer implented an ad hoc type inference forFuture.then(and overrides) treating it as if the onValue callback was typed to returnFutureOrfor the purposes of inference. This ad hoc inference has been removed now thatFutureOrhas been added.Packages that implement
Futuremust either type theonValueparameter to.thenas returningFutureOr<T>, or else must leave the type of the parameter entirely to allow inference to fill in the type. -
During static analysis, a function or setter declared using
=>with return typevoidnow allows the returned expression to have any type.
-
Dartium
Dartium is now based on Chrome v50. See Core library changes above for details on the changed APIs.
-
Pub
-
pub buildandpub serve-
Added support for the Dart Development Compiler.
Unlike dart2js, this new compiler is modular, which allows pub to do incremental re-builds for
pub serve, and potentiallypub buildin the future.In practice what that means is you can edit your Dart files, refresh in Chrome (or other supported browsers), and see your edits almost immediately. This is because pub is only recompiling your package, not all packages that you depend on.
There is one caveat with the new compiler, which is that your package and your dependencies must all be strong mode clean. If you are getting an error compiling one of your dependencies, you will need to file bugs or send pull requests to get them strong mode clean.
There are two ways of opting into the new compiler:
-
Use the new
--web-compilerflag, which supportsdartdevc,dart2jsornoneas options. This is the easiest way to try things out without changing the default. -
Add config to your pubspec. There is a new
webkey which supports a single key calledcompiler. This is a map from mode names to compiler to use. For example, to default to dartdevc in debug mode you can add the following to your pubspec:web: compiler: debug: dartdevc
You can also use the new compiler to run your tests in Chrome much more quickly than you can with dart2js. In order to do that, run
pub serve test --web-compiler=dartdevc, and then runpub run test -p chrome --pub-serve=8080. -
-
The
--no-dart2jsflag has been deprecated in favor of--web-compiler=none. -
pub buildwill use a failing exit code if there are errors in any transformer.
-
-
pub publish-
Added support for the UNLICENSE file.
-
Packages that depend on the Flutter SDK may be published.
-
-
pub getandpub upgrade- Don't dump a stack trace when a network error occurs while fetching packages.
-
-
dartfmt
- Preserve type parameters in new generic function typedef syntax.
- Add self-test validation to ensure formatter bugs do not cause user code to be lost.
- As of this release, we'll show a warning when using the MIPS architecture. Unless we learn about any critical use of Dart on MIPS in the meantime, we're planning to deprecate support for MIPS starting with the next stable release.
- Breaking change - it is now a strong mode error if a mixin causes a name conflict between two private members (field/getter/setter/method) from a different library. (SDK issue 28809).
lib1.dart:
class A {
int _x;
}
class B {
int _x;
}lib2.dart:
import 'lib1.dart';
class C extends A with B {} error • The private name _x, defined by B, conflicts with the same name defined by A at tmp/lib2.dart:3:24 • private_collision_in_mixin_application
-
Breaking change - strong mode will prefer the expected type to infer generic types, functions, and methods (SDK issue 27586).
main() { List<Object> foo = /*infers: <Object>*/['hello', 'world']; var bar = /*infers: <String>*/['hello', 'world']; }
-
Strong mode inference error messages are improved (SDK issue 29108).
import 'dart:math'; test(Iterable/* fix is to add <num> here */ values) { num n = values.fold(values.first as num, max); }
Now produces the error on the generic function "max":
Couldn't infer type parameter 'T'. Tried to infer 'dynamic' for 'T' which doesn't work: Function type declared as '<T extends num>(T, T) → T' used where '(num, dynamic) → num' is required. Consider passing explicit type argument(s) to the generic. -
Strong mode supports overriding fields,
@virtualis no longer required (SDK issue 28120).class C { int x = 42; } class D extends C { get x { print("x got called"); return super.x; } } main() { print(new D().x); }
-
Strong mode down cast composite warnings are no longer issued by default. (SDK issue 28588).
void test() {
List untyped = [];
List<int> typed = untyped; // No down cast composite warning
}To opt back into the warnings, add the following to the .analysis_options file for your project.
analyzer:
errors:
strong_mode_down_cast_composite: warning
dart:core- Added
Uri.isSchemefunction to check the scheme of a URI. Example:uri.isScheme("http"). Ignores case when comparing. - Make
UriData.parsevalidate its input better. If the data is base-64 encoded, the data is normalized wrt. alphabet and padding, and it contains invalid base-64 data, parsing fails. Also normalizes non-base-64 data.
- Added
dart:io- Added functions
File.lastAccessed,File.lastAccessedSync,File.setLastModified,File.setLastModifiedSync,File.setLastAccessed, andFile.setLastAccessedSync. - Added
{Stdin,Stdout}.supportsAnsiEscapes.
- Added functions
- Calls to
print()andStdout.write*()now correctly print unicode characters to the console on Windows. Calls toStdout.add*()behave as before.
-
Analysis
dartanalyzernow follows the same rules as the analysis server to find an analysis options file, stopping when an analysis options file is found:- Search up the directory hierarchy looking for an analysis options file.
- If analyzing a project referencing the Flutter
package, then use the
default Flutter analysis options
found in
package:flutter. - If in a Bazel workspace, then use the analysis options in
package:dart.analysis_options/default.yamlif it exists. - Use the default analysis options rules.
- In addition, specific to
dartanalyzer:- an analysis options file can be specified on the command line via
--optionsand that file will be used instead of searching for an analysis options file. - any analysis option specified on the command line
(e.g.
--strongor--no-strong) takes precedence over any corresponding value specified in the analysis options file.
- an analysis options file can be specified on the command line via
-
Dartium, dart2js, and DDC
- Imports to
dart:ioare allowed, but the imported library is not supported and will likely fail on most APIs at runtime. This change was made as a stopgap measure to make it easier to write libraries that share code between platforms (like packagehttp). This might change again when configuration specific imports are supported.
- Imports to
-
Pub
- Now sends telemetry data to
pub.dartlang.orgto allow better understanding of why a particular package is being accessed. pub publish- Warns if a package imports a package that's not a dependency from within
lib/orbin/, or a package that's not a dev dependency from withinbenchmark/,example/,test/ortool/. - No longer produces "UID too large" errors on OS X. All packages are now uploaded with the user and group names set to "pub".
- No longer fails with a stack overflow when uploading a package that uses Git submodules.
- Warns if a package imports a package that's not a dependency from within
pub getandpub upgrade- Produce more informative error messages if they're run directly in a package that uses Flutter.
- Properly unlock SDK and path dependencies if they have a new version that's also valid according to the user's pubspec.
- Now sends telemetry data to
-
dartfmt
- Support new generic function typedef syntax.
- Make the precedence of cascades more visible.
- Fix a couple of places where spurious newlines were inserted.
- Correctly report unchanged formatting when reading from stdin.
- Ensure space between
-and--. Code that does this is pathological, but it technically meant dartfmt could change the semantics of the code. - Preserve a blank line between enum cases.
- Other small formatting tweaks.
Patch release, resolves two issues:
-
Dart VM crash: Issue 28072
-
Dart VM bug combining types, await, and deferred loading: Issue 28678
-
Breaking change: 'Generalized tear-offs' are no longer supported, and will cause errors. We updated the language spec and added warnings in 1.21, and are now taking the last step to fully de-support them. They were previously only supported in the VM, and there are almost no known uses of them in the wild.
-
The
assert()statement has been expanded to support an optional secondmessageargument (SDK issue 27342).The message is displayed if the assert fails. It can be any object, and it is accessible as
AssertionError.message. It can be used to provide more user friendly exception outputs. As an example, the following assert:assert(configFile != null, "Tool config missing. Please see https://goo.gl/k8iAi for details.");
would produce the following exception output:
Unhandled exception: 'file:///Users/mit/tmp/tool/bin/main.dart': Failed assertion: line 9 pos 10: 'configFile != null': Tool config missing. Please see https://goo.gl/k8iAi for details. #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:33) #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:29) #2 main (file:///Users/mit/tmp/tool/bin/main.dart:9:10) -
The
Nulltype has been moved to the bottom of the type hierarchy. As such, it is considered a subtype of every other type. Thenullliteral was always treated as a bottom type. Now the named classNullis too:const empty = <Null>[]; String concatenate(List<String> parts) => parts.join(); int sum(List<int> numbers) => numbers.fold(0, (sum, n) => sum + n); concatenate(empty); // OK. sum(empty); // OK.
-
Introduce
covariantmodifier on parameters. It indicates that the parameter (and the corresponding parameter in any method that overrides it) has looser override rules. In strong mode, these require a runtime type check to maintain soundness, but enable an architectural pattern that is useful in some code.It lets you specialize a family of classes together, like so:
abstract class Predator { void chaseAndEat(covariant Prey p); } abstract class Prey {} class Mouse extends Prey {} class Seal extends Prey {} class Cat extends Predator { void chaseAndEat(Mouse m) => ... } class Orca extends Predator { void chaseAndEat(Seal s) => ... }
This isn't statically safe, because you could do:
Predator predator = new Cat(); // Upcast. predator.chaseAndEat(new Seal()); // Cats can't eat seals!
To preserve soundness in strong mode, in the body of a method that uses a covariant override (here,
Cat.chaseAndEat()), the compiler automatically inserts a check that the parameter is of the expected type. So the compiler gives you something like:class Cat extends Predator { void chaseAndEat(o) { var m = o as Mouse; ... } }
Spec mode allows this unsound behavior on all parameters, even though users rarely rely on it. Strong mode disallowed it initially. Now, strong mode lets you opt into this behavior in the places where you do want it by using this modifier. Outside of strong mode, the modifier is ignored.
-
Change instantiate-to-bounds rules for generic type parameters when running in strong mode. If you leave off the type parameters from a generic type, we need to decide what to fill them in with. Dart 1.0 says just use
dynamic, but that isn't sound:class Abser<T extends num> { void absThis(T n) { n.abs(); } } var a = new Abser(); // Abser<dynamic>. a.absThis("not a num");
We want the body of
absThis()to be able to safely assumenis at least anum-- that's why there's a constraint on T, after all. Implicitly usingdynamicas the type parameter in this example breaks that.Instead, strong mode uses the bound. In the above example, it fills it in with
num, and then the second line where a string is passed becomes a static error.However, there are some cases where it is hard to figure out what that default bound should be:
class RuhRoh<T extends Comparable<T>> {}
Strong mode's initial behavior sometimes produced surprising, unintended results. For 1.22, we take a simpler approach and then report an error if a good default type argument can't be found.
-
Define
FutureOr<T>for code that works with either a future or an immediate value of some type. For example, say you do a lot of text manipulation, and you want a handy function to chain a bunch of them:typedef String StringSwizzler(String input); String swizzle(String input, List<StringSwizzler> swizzlers) { var result = input; for (var swizzler in swizzlers) { result = swizzler(result); } return result; }
This works fine:
main() { var result = swizzle("input", [ (s) => s.toUpperCase(), (s) => () => s * 2) ]); print(result); // "INPUTINPUT". }
Later, you realize you'd also like to support swizzlers that are asynchronous (maybe they look up synonyms for words online). You could make your API strictly asynchronous, but then users of simple synchronous swizzlers have to manually wrap the return value in a
Future.value(). Ideally, yourswizzle()function would be "polymorphic over asynchrony". It would allow both synchronous and asynchronous swizzlers. Becauseawaitaccepts immediate values, it is easy to implement this dynamically:Future<String> swizzle(String input, List<StringSwizzler> swizzlers) async { var result = input; for (var swizzler in swizzlers) { result = await swizzler(result); } return result; } main() async { var result = swizzle("input", [ (s) => s.toUpperCase(), (s) => new Future.delayed(new Duration(milliseconds: 40), () => s * 2) ]); print(await result); }
What should the declared return type on StringSwizzler be? In the past, you had to use
dynamicorObject, but that doesn't tell the user much. Now, you can do:typedef FutureOr<String> StringSwizzler(String input);
Like the name implies,
FutureOr<String>is a union type. It can be aStringor aFuture<String>, but not anything else. In this case, that's not super useful beyond just stating a more precise type for readers of the code. It does give you a little better error checking in code that uses the result of that.FutureOr<T>becomes really important in generic methods likeFuture.then(). In those cases, having the type system understand this magical union type helps type inference figure out the type argument ofthen()based on the closure you pass it.Previously, strong mode had hard-coded rules for handling
Future.then()specifically.FutureOr<T>exposes that functionality so third-party APIs can take advantage of it too.
-
Dart2Js
- Remove support for (long-time deprecated) mixin typedefs.
-
Pub
-
Avoid using a barback asset server for executables unless they actually use transformers. This makes precompilation substantially faster, produces better error messages when precompilation fails, and allows globally-activated executables to consistently use the
Isolate.resolvePackageUri()API. -
On Linux systems, always ignore packages' original file owners and permissions when extracting those packages. This was already the default under most circumstances.
-
Properly close the standard input stream of child processes started using
pub run. -
Handle parse errors from the package cache more gracefully. A package whose pubspec can't be parsed will now be ignored by
pub get --offlineand deleted bypub cache repair. -
Make
pub runrun executables in spawned isolates. This lets them handle signals and use standard IO reliably. -
Fix source-maps produced by dart2js when running in
pub serve: URL references to assets from packages match the location wherepub serveserves them (packages/package_name/instead of../packages/package_name/).
-
- The SDK now uses GN rather than gyp to generate its build files, which will
now be exclusively ninja flavored. Documentation can be found on our
wiki. Also see the
help message of
tools/gn.py. This change is in response to the deprecation of gyp. Build file generation with gyp will continue to be available in this release by setting the environment variableDART_USE_GYPbefore runninggclient syncorgclient runhooks, but this will be removed in a future release.
Patch release, resolves one issue:
- Dart VM: Snapshots of generic functions fail. Issue 28072
-
Support generic method syntax. Type arguments are not available at runtime. For details, check the informal specification.
-
Support access to initializing formals, e.g., the use of
xto initializeyinclass C { var x, y; C(this.x): y = x; }. Please check the informal specification for details. -
Don't warn about switch case fallthrough if the case ends in a
rethrowstatement. (SDK issue 27650) -
Also don't warn if the entire switch case is wrapped in braces - as long as the block ends with a
break,continue,rethrow,returnorthrow. -
Allow
=as well as:as separator for named parameter default values.enableFlags({bool hidden: false}) { … }
can now be replaced by
enableFlags({bool hidden = false}) { … }
(SDK issue 27559)
-
dart:core:Set.differencenow takes aSet<Object>as argument. (SDK issue 27573) -
dart:developer- Added
Serviceclass.- Allows inspecting and controlling the VM service protocol HTTP server.
- Provides an API to access the ID of an
Isolate.
- Added
-
Dart Dev Compiler
- Support calls to
loadLibrary()on deferred libraries. Deferred libraries are still loaded eagerly. (SDK issue 27343)
- Support calls to
Patch release, resolves one issue:
- Dartium: Fixes a bug that caused crashes. No issue filed.
-
It is no longer a warning when casting from dynamic to a composite type (SDK issue 27766).
main() { dynamic obj = <int>[1, 2, 3]; // This is now allowed without a warning. List<int> list = obj; }
-
We have improved the way that the VM locates the native code library for a native extension (e.g.
dart-ext:import). We have updated this article on native extensions to reflect the VM's improved behavior. -
Linux builds of the VM will now use the
tcmalloclibrary for memory allocation. This has the advantages of better debugging and profiling support and faster small allocations, with the cost of slightly larger initial memory footprint, and slightly slower large allocations. -
We have improved the way the VM searches for trusted root certificates for secure socket connections on Linux. First, the VM will look for trusted root certificates in standard locations on the file system (
/etc/pki/tls/certs/ca-bundle.crtfollowed by/etc/ssl/certs), and only if these do not exist will it fall back on the builtin trusted root certificates. This behavior can be overridden on Linux with the new flags--root-certs-fileand--root-certs-cache. The former is the path to a file containing the trusted root certificates, and the latter is the path to a directory containing root certificate files hashed usingc_rehash. -
The VM now throws a catchable
Errorwhen method compilation fails. This allows easier debugging of syntax errors, especially when testing. (SDK issue 23684)
dart:core: Remove deprecatedResourceclass. Use the class inpackage:resourceinstead.dart:asyncFuture.waitnow catches synchronous errors and returns them in the returned Future. (SDK issue 27249)- More aggressively returns a
FutureonStream.canceloperations. Discourages to returnnullfromcancel. (SDK issue 26777) - Fixes a few bugs where the cancel future wasn't passed through transformations.
dart:io- Added
WebSocket.addUtf8Textto allow sending a pre-encoded text message without a round-trip UTF-8 conversion. (SDK issue 27129)
- Added
-
Breaking change - it is an error if a generic type parameter cannot be inferred (SDK issue 26992).
class Cup<T> { Cup(T t); } main() { // Error because: // - if we choose Cup<num> it is not assignable to `cOfInt`, // - if we choose Cup<int> then `n` is not assignable to int. num n; C<int> cOfInt = new C(n); }
-
New feature - use
@checkedto override a method and tighten a parameter type (SDK issue 25578).import 'package:meta/meta.dart' show checked; class View { addChild(View v) {} } class MyView extends View { // this override is legal, it will check at runtime if we actually // got a MyView. addChild(@checked MyView v) {} } main() { dynamic mv = new MyView(); mv.addChild(new View()); // runtime error }
-
New feature - use
@virtualto allow field overrides in strong mode (SDK issue 27384).import 'package:meta/meta.dart' show virtual; class Base { @virtual int x; } class Derived extends Base { int x; // Expose the hidden storage slot: int get superX => super.x; set superX(int v) { super.x = v; } }
-
Breaking change - infer list and map literals from the context type as well as their values, consistent with generic methods and instance creation (SDK issue 27151).
import 'dart:async'; main() async { var b = new Future<B>.value(new B()); var c = new Future<C>.value(new C()); var/*infer List<Future<A>>*/ list = [b, c]; var/*infer List<A>*/ result = await Future.wait(list); } class A {} class B extends A {} class C extends A {}
-
dartfmt- upgraded to v0.2.10- Don't crash on annotations before parameters with trailing commas.
- Always split enum declarations if they end in a trailing comma.
- Add
--set-exit-if-changedto set the exit code on a change.
-
Pub
- Pub no longer generates a
packages/directory by default. Instead, it generates a.packagesfile, called a package spec. To generate apackages/directory in addition to the package spec, use the--packages-dirflag withpub get,pub upgrade, andpub downgrade. See the Good-bye symlinks article for details.
- Pub no longer generates a
Patch release, resolves one issue:
- Dartdoc: Fixes a bug that prevented generation of docs. (Dartdoc issue 1233)
- The language now allows a trailing comma after the last argument of a call and the last parameter of a function declaration. This can make long argument or parameter lists easier to maintain, as commas can be left as-is when reordering lines. For details, see SDK issue 26644.
-
dartfmt- upgraded to v0.2.9+1- Support trailing commas in argument and parameter lists.
- Gracefully handle read-only files.
- About a dozen other bug fixes.
-
Pub
-
Added a
--no-packages-dirflag topub get,pub upgrade, andpub downgrade. When this flag is passed, pub will not generate apackages/directory, and will remove that directory and any symlinks to it if they exist. Note that this replaces the unsupported--no-package-symlinksflag. -
Added the ability for packages to declare a constraint on the Flutter SDK:
environment: flutter: ^0.1.2 sdk: >=1.19.0 <2.0.0
A Flutter constraint will only be satisfiable when pub is running in the context of the
flutterexecutable, and when the Flutter SDK version matches the constraint. -
Added
sdkas a new package source that fetches packages from a hard-coded SDK. Currently only theflutterSDK is supported:dependencies: flutter_driver: sdk: flutter version: ^0.0.1
A Flutter
sdkdependency will only be satisfiable when pub is running in the context of theflutterexecutable, and when the Flutter SDK contains a package with the given name whose version matches the constraint. -
tarfiles on Linux are now created with0as the user and group IDs. This fixes a crash when publishing packages while using Active Directory. -
Fixed a bug where packages from a hosted HTTP URL were considered the same as packages from an otherwise-identical HTTPS URL.
-
Fixed timer formatting for timers that lasted longer than a minute.
-
Eliminate some false negatives when determining whether global executables are on the user's executable path.
-
-
dart2jsdart2dart(akadart2js --output-type=dart) has been removed (this was deprecated in Dart 1.11).
- The dependency on BoringSSL has been rolled forward. Going forward, builds of the Dart VM including secure sockets will require a compiler with C++11 support. For details, see the Building wiki page.
-
New feature - an option to disable implicit casts (SDK issue 26583), see the documentation for usage instructions and examples.
-
New feature - an option to disable implicit dynamic (SDK issue 25573), see the documentation for usage instructions and examples.
-
Breaking change - infer generic type arguments from the constructor invocation arguments (SDK issue 25220).
var map = new Map<String, String>(); // infer: Map<String, String> var otherMap = new Map.from(map);
-
Breaking change - infer local function return type (SDK issue 26414).
void main() { // infer: return type is int f() { return 40; } int y = f() + 2; // type checks print(y); }
-
Breaking change - allow type promotion from a generic type parameter (SDK issue 26414).
void fn/*<T>*/(/*=T*/ object) { if (object is String) { // Treat `object` as `String` inside this block. // But it will require a cast to pass it to something that expects `T`. print(object.substring(1)); } }
-
Breaking change - smarter inference for Future.then (SDK issue 25944). Previous workarounds that use async/await or
.then/*<Future<SomeType>>*/should no longer be necessary.// This will now infer correctly. Future<List<int>> t2 = f.then((_) => [3]); // This infers too. Future<int> t2 = f.then((_) => new Future.value(42));
-
Breaking change - smarter inference for async functions (SDK issue 25322).
void test() async { List<int> x = await [4]; // was previously inferred List<int> y = await new Future.value([4]); // now inferred too }
-
Breaking change - sideways casts are no longer allowed (SDK issue 26120).
Patch release, resolves two issues and improves performance:
-
Debugger: Fixes a bug that crashes the VM (SDK issue 26941)
-
VM: Fixes an optimizer bug involving closures, try, and await (SDK issue 26948)
-
Dart2js: Speeds up generated code on Firefox (https://codereview.chromium.org/2180533002)
dart:core- Improved performance when parsing some common URIs.
- Fixed bug in
Uri.resolve(SDK issue 26804).
dart:io- Adds file locking modes
FileLock.BLOCKING_SHAREDandFileLock.BLOCKING_EXCLUSIVE.
- Adds file locking modes
Patch release, resolves two issues:
-
VM: Fixes a bug that caused crashes in async functions. (SDK issue 26668)
-
VM: Fixes a bug that caused garbage collection of reachable weak properties. (https://codereview.chromium.org/2041413005)
-
dart:convert- Deprecate
ChunkedConverterwhich was erroneously added in 1.16.
- Deprecate
-
dart:coreUri.replacesupports iterables as values for the query parameters.Uri.parseIPv6Addressreturns aUint8List.
-
dart:io- Added
NetworkInterface.listSupported, which istruewhenNetworkInterface.listis supported, andfalseotherwise. Currently,NetworkInterface.listis not supported on Android.
- Added
-
Pub
-
TAR files created while publishing a package on Mac OS and Linux now use a more portable format.
-
Errors caused by invalid arguments now print the full usage information for the command.
-
SDK constraints for dependency overrides are no longer considered when determining the total SDK constraint for a lockfile.
-
A bug has been fixed in which a lockfile was considered up-to-date when it actually wasn't.
-
A bug has been fixed in which
pub get --offlinewould crash when a prerelease version was selected.
-
-
Dartium and content shell
- Debugging Dart code inside iframes improved, was broken.
Patch release, resolves one issue:
- VM: Fixes a bug that caused intermittent hangs on Windows. (SDK issue 26400)
-
dart:convert-
Added
BASE64URLcodec and correspondingBase64Codec.urlSafeconstructor. -
Introduce
ChunkedConverterand deprecate chunked methods onConverter.
-
-
dart:htmlThere have been a number of BREAKING changes to align APIs with recent changes in Chrome. These include:
-
Chrome's
ShadowRootinterface no longer has the methodsgetElementById,getElementsByClassName, andgetElementsByTagName, e.g.,elem.shadowRoot.getElementsByClassName('clazz')
should become:
elem.shadowRoot.querySelectorAll('.clazz')
-
The
clipboardDataproperty has been removed fromKeyEventandEvent. It has been moved to the newClipboardEventclass, which is now used bycopy,cut, andpasteevents. -
The
layerproperty has been removed fromKeyEventandUIEvent. It has been moved toMouseEvent. -
The
Point get pageproperty has been removed fromUIEvent. It still exists onMouseEventandTouch.
There have also been a number of other additions and removals to
dart:html,dart:indexed_db,dart:svg,dart:web_audio, anddart:web_glthat correspond to changes to Chrome APIs between v39 and v45. Many of the breaking changes represent APIs that would have caused runtime exceptions when compiled to Javascript and run on recent Chrome releases. -
-
dart:io- Added
SecurityContext.alpnSupported, which is true if a platform supports ALPN, and false otherwise.
- Added
For performance reasons, a potentially BREAKING change was added for
libraries that use JS interop.
Any Dart file that uses @JS annotations on declarations (top-level functions,
classes or class members) to interop with JavaScript code will require that the
file have the annotation @JS() on a library directive.
@JS()
library my_library;The analyzer will enforce this by generating the error:
The @JS() annotation can only be used if it is also declared on the library
directive.
If part file uses the @JS() annotation, the library that uses the part should
have the @JS() annotation e.g.,
// library_1.dart
@JS()
library library_1;
import 'package:js/js.dart';
part 'part_1.dart';// part_1.dart
part of library_1;
@JS("frameworkStabilizers")
external List<FrameworkStabilizer> get frameworkStabilizers;If your library already has a JS module e.g.,
@JS('array.utils')
library my_library;Then your library will work without any additional changes.
-
Static checking of
for instatements. These will now produce static warnings:// Not Iterable. for (var i in 1234) { ... } // String cannot be assigned to int. for (int n in <String>["a", "b"]) { ... }
-
Pub
-
pub servenow provides caching headers that should improve the performance of requesting large files multiple times. -
Both
pub getandpub upgradenow have a--no-precompileflag that disables precompilation of executables and transformed dependencies. -
pub publishnow resolves symlinks when publishing from a Git repository. This matches the behavior it always had when publishing a package that wasn't in a Git repository.
-
-
Dart Dev Compiler
-
The experimental
dartdevcexecutable has been added to the SDK. -
It will help early adopters validate the implementation and provide feedback.
dartdevcis not yet ready for production usage. -
Read more about the Dart Dev Compiler here.
-
-
dart:async- Made
StreamViewclass aconstclass.
- Made
-
dart:core- Added
Uri.queryParametersAllto handle multiple query parameters with the same name.
- Added
-
dart:io- Added
SecurityContext.usePrivateKeyBytes,SecurityContext.useCertificateChainBytes,SecurityContext.setTrustedCertificatesBytes, andSecurityContext.setClientAuthoritiesBytes. - Breaking The named
directoryargument ofSecurityContext.setTrustedCertificateshas been removed. - Added support to
SecurityContextfor PKCS12 certificate and key containers. - All calls in
SecurityContextthat accept certificate data now accept an optional named parameterpassword, similar toSecurityContext.usePrivateKeyBytes, for use as the password for PKCS12 data.
- Added
-
Dartium and content shell
- The Chrome-based tools that ship as part of the Dart SDK – Dartium and content shell – are now based on Chrome version 45 (instead of Chrome 39).
- Dart browser libraries (
dart:html,dart:svg, etc) have not been updated.- These are still based on Chrome 39.
- These APIs will be updated in a future release.
- Note that there are experimental APIs which have changed in the underlying
browser, and will not work with the older libraries.
For example,
Element.animate.
-
dartfmt- upgraded to v0.2.4- Better handling for long collections with comments.
- Always put member metadata annotations on their own line.
- Indent functions in named argument lists with non-functions.
- Force the parameter list to split if a split occurs inside a function-typed parameter.
- Don't force a split for before a single named argument if the argument itself splits.
- Fixed a documentation bug where the field
extensionRPCsinIsolatewas not marked optional.
-
Added support for configuration-specific imports. On the VM and
dart2js, they can be enabled with--conditional-directives.The analyzer requires additional configuration:
analyzer: language: enableConditionalDirectives: true
Read about configuring the analyzer for more details.
Patch release, resolves three issues:
-
VM: Fixed a code generation bug on x64. (SDK commit 834b3f02)
-
dart:io: Fixed EOF detection when reading some special device files. (SDK issue 25596) -
Pub: Fixed an error using hosted dependencies in SDK version 1.14. (Pub issue 1386)
Patch release, resolves one issue:
- Debugger: Fixes a VM crash when a debugger attempts to set a break point during isolate initialization. (SDK issue 25618)
-
dart:async- Added
Future.anystatic method. - Added
Stream.fromFuturesconstructor.
- Added
-
dart:convertBase64Decoder.convertnow takes optionalstartandendparameters.
-
dart:core- Added
currentgetter toStackTraceclass. Uriclass added support for data URIs- Added two new constructors:
dataFromBytesanddataFromString. - Added a
datagetter fordata:URIs with a newUriDataclass for the return type.
- Added two new constructors:
- Added
growableparameter toList.filledconstructor. - Added microsecond support to
DateTime:DateTime.microsecond,DateTime.microsecondsSinceEpoch, andnew DateTime.fromMicrosecondsSinceEpoch.
- Added
-
dart:mathRandomadded asecureconstructor returning a cryptographically secure random generator which reads from the entropy source provided by the embedder for every generated random value.
-
dart:ioPlatformadded a staticisIOSgetter andPlatform.operatingSystemmay now returnios.Platformadded a staticpackageConfiggetter.- Added support for WebSocket compression as standardized in RFC 7692.
- Compression is enabled by default for all WebSocket connections.
- The optionally named parameter
compressionon the methodsWebSocket.connect,WebSocket.fromUpgradedSocket, andWebSocketTransformer.upgradeand theWebSocketTransformerconstructor can be used to modify or disable compression using the newCompressionOptionsclass.
- The optionally named parameter
-
dart:isolate- Added experimental support for Package Resolution Configuration.
- Added
packageConfigandpackageRootinstance getters toIsolate. - Added a
resolvePackageUrimethod toIsolate. - Added named arguments
packageConfigandautomaticPackageResolutionto theIsolate.spawnUriconstructor.
- Added
- Added experimental support for Package Resolution Configuration.
-
dartfmt-
Better line splitting in a variety of cases.
-
Other optimizations and bug fixes.
-
-
Pub
-
Breaking: Pub now eagerly emits an error when a pubspec's "name" field is not a valid Dart identifier. Since packages with non-identifier names were never allowed to be published, and some of them already caused crashes when being written to a
.packagesfile, this is unlikely to break many people in practice. -
Breaking: Support for
barbackversions prior to 0.15.0 (released July 2014) has been dropped. Pub will no longer install these older barback versions. -
pub servenow GZIPs the assets it serves to make load times more similar to real-world use-cases. -
pub depsnow supports a--no-devflag, which causes it to emit the dependency tree as it would be if nodev_dependencieswere in use. This makes it easier to see your package's dependency footprint as your users will experience it. -
pub global runnow detects when a global executable's SDK constraint is no longer met and errors out, rather than trying to run the executable anyway. -
Pub commands that check whether the lockfile is up-to-date (
pub run,pub deps,pub serve, andpub build) now do additional verification. They ensure that any path dependencies' pubspecs haven't been changed, and they ensure that the current SDK version is compatible with all dependencies. -
Fixed a crashing bug when using
pub global runon a global script that didn't exist. -
Fixed a crashing bug when a pubspec contains a dependency without a source declared.
-
Patch release, resolves one issue:
- dart2js: Stack traces are not captured correctly (SDK issue [25235] (dart-lang#25235))
Patch release, resolves three issues:
-
VM type propagation fix: Resolves a potential crash in the Dart VM (SDK commit [dff13be] (https://github.com/dart-lang/sdk/commit/dff13bef8de104d33b04820136da2d80f3c835d7))
-
dart2js crash fix: Resolves a crash in pkg/js and dart2js (SDK issue [24974] (dart-lang#24974))
-
Pub get crash on ARM: Fixes a crash triggered when running 'pub get' on ARM processors such as those on a Raspberry Pi (SDK issue [24855] (dart-lang#24855))
-
dart:asyncStreamControlleradded getters foronListen,onPause, andonResumewith the corresponding newtypedef void ControllerCallback().StreamControlleradded a getter foronCancelwith the corresponding newtypedef ControllerCancelCallback();StreamTransformerinstances created withfromHandlerswith nohandleErrorcallback now forward stack traces along with errors to the resulting streams.
-
dart:convert- Added support for Base-64 encoding and decoding.
- Added new classes
Base64Codec,Base64Encoder, andBase64Decoder. - Added new top-level
const Base64Codec BASE64.
- Added new classes
- Added support for Base-64 encoding and decoding.
-
dart:coreUriaddedremoveFragmentmethod.String.allMatches(implementingPattern.allMatches) is now lazy, as allallMatchesimplementations are intended to be.Resourceis deprecated, and will be removed in a future release.
-
dart:developer- Added
Timelineclass for interacting with Observatory's timeline feature. - Added
ServiceExtensionHandler,ServiceExtensionResponse, andregisterExtensionwhich enable developers to provide their own VM service protocol extensions.
- Added
-
dart:html,dart:indexed_db,dart:svg,dart:web_audio,dart:web_gl,dart:web_sql- The return type of some APIs changed from
doubletonum. Dartium is now using JS interop for most operations. JS does not distinguish between numeric types, and will return a number as an int if it fits in an int. This will mostly cause an error if you assign to something typeddoublein checked mode. You may need to insert atoDouble()call or acceptnum. Examples of APIs that are affected includeElement.getBoundingClientRectandTextMetrics.width.
- The return type of some APIs changed from
-
dart:io-
Breaking: Secure networking has changed, replacing the NSS library with the BoringSSL library.
SecureSocket,SecureServerSocket,RawSecureSocket,RawSecureServerSocket,HttpClient, andHttpServernow all use aSecurityContextobject which contains the certificates and keys used for secure TLS (SSL) networking.This is a breaking change for server applications and for some client applications. Certificates and keys are loaded into the
SecurityContextfrom PEM files, instead of from an NSS certificate database. Information about how to change applications that use secure networking is at https://www.dartlang.org/server/tls-ssl.html -
HttpClientno longer sends URI fragments in the request. This is not allowed by the HTTP protocol. TheHttpServerstill gracefully receives fragments, but discards them before delivering the request. -
To allow connections to be accepted on the same port across different isolates, set the
sharedargument totruewhen creating server socket andHttpServerinstances.- The deprecated
ServerSocketReferenceandRawServerSocketReferenceclasses have been removed. - The corresponding
referenceproperties onServerSocketandRawServerSockethave been removed.
- The deprecated
-
-
dart:isolatespawnUriadded anenvironmentnamed argument.
-
dart2jsand Dartium now support improved Javascript Interoperability via the js package. -
docgenanddartdocgenno longer ship in the SDK. Thedocgensources have been removed from the repository. -
This is the last release to ship the VM's "legacy debug protocol". We intend to remove the legacy debug protocol in Dart VM 1.14.
-
The VM's Service Protocol has been updated to version 3.0 to take care of a number of issues uncovered by the first few non-observatory clients. This is a potentially breaking change for clients.
-
Dartium has been substantially changed. Rather than using C++ calls into Chromium internals for DOM operations it now uses JS interop. The DOM objects in
dart:htmland related libraries now wrap a JavaScript object and delegate operations to it. This should be mostly transparent to users. However, performance and memory characteristics may be different from previous versions. There may be some changes in which DOM objects are wrapped as Dart objects. For example, if you get a reference to a Window object, even through JS interop, you will always see it as a Dart Window, even when used cross-frame. We expect the change to using JS interop will make it much simpler to update to new Chrome versions.
-
dart:io- A memory leak in creation of Process objects is fixed.
-
Pub
-
Pub will now respect
.gitignorewhen validating a package before it's published. For example, if aLICENSEfile exists but is ignored, that is now an error. -
If the package is in a subdirectory of a Git repository and the entire subdirectory is ignored with
.gitignore, pub will act as though nothing was ignored instead of uploading an empty package. -
The heuristics for determining when
pub getneeds to be run before various commands have been improved. There should no longer be false positives when non-dependency sections of the pubspec have been modified.
-
- Null-aware operators
??: if null operator.expr1 ?? expr2evaluates toexpr1if notnull, otherwiseexpr2.??=: null-aware assignment.v ??= exprcausesvto be assignedexpronly ifvisnull.x?.p: null-aware access.x?.pevaluates tox.pifxis notnull, otherwise evaluates tonull.x?.m(): null-aware method invocation.x?.m()invokesmonly ifxis notnull.
-
dart:asyncStreamControlleradded setters for theonListen,onPause,onResumeandonCancelcallbacks.
-
dart:convertLineSplitteradded asplitstatic method returning anIterable.
-
dart:coreUriclass now perform path normalization when a URI is created. This removes most..and.sequences from the URI path. Purely relative paths (no scheme or authority) are allowed to retain some leading "dot" segments. Also addedhasAbsolutePath,hasEmptyPath, andhasSchemeproperties.
-
dart:developer- New
logfunction to transmit logging events to Observatory.
- New
-
dart:htmlNodeTreeSanitizeradded theconst trustedfield. It can be used instead of defining aNullTreeSanitizerclass when callingsetInnerHtmlor other methods that create DOM from text. It is also more efficient, skipping the creation of aDocumentFragment.
-
dart:io -
dart:isolate- Added
onError,onExitanderrorsAreFatalparameters toIsolate.spawnUri.
- Added
-
dart:mirrorsInstanceMirror.delegatemoved up toObjectMirror.- Fix InstanceMirror.getField optimization when the selector is an operator.
- Fix reflective NoSuchMethodErrors to match their non-reflective counterparts when due to argument mismatches. (VM only)
-
Documentation tools
-
dartdocis now the default tool to generate static HTML for API docs. Learn more. -
docgenanddartdocgenhave been deprecated. Currently plan is to remove them in 1.13.
-
-
Formatter (
dartfmt)-
Over 50 bugs fixed.
-
Optimized line splitter is much faster and produces better output on complex code.
-
-
Observatory
-
Allocation profiling.
-
New feature to display output from logging.
-
Heap snapshot analysis works for 64-bit VMs.
-
Improved ability to inspect typed data, regex and compiled code.
-
Ability to break on all or uncaught exceptions from Observatory's debugger.
-
Ability to set closure-specific breakpoints.
-
'anext' - step past await/yield.
-
Preserve when a variable has been expanded/unexpanded in the debugger.
-
Keep focus on debugger input box whenever possible.
-
Echo stdout/stderr in the Observatory debugger. Standalone-only so far.
-
Minor fixes to service protocol documentation.
-
-
Pub
-
Breaking: various commands that previously ran
pub getimplicitly no longer do so. Instead, they merely check to make sure the ".packages" file is newer than the pubspec and the lock file, and fail if it's not. -
Added support for
--verbosity=errorand--verbosity=warning. -
pub servenow collapses multiple GET requests into a single line of output. For full output, use--verbose. -
pub depshas improved formatting for circular dependencies on the entrypoint package. -
pub runandpub global run-
Breaking: to match the behavior of the Dart VM, executables no longer run in checked mode by default. A
--checkedflag has been added to run them in checked mode manually. -
Faster start time for executables that don't import transformed code.
-
Binstubs for globally-activated executables are now written in the system encoding, rather than always in
UTF-8. To update existing executables, runpub cache repair.
-
-
pub getandpub upgrade-
Pub will now generate a ".packages" file in addition to the "packages" directory when running
pub getor similar operations, per the package spec proposal. Pub now has a--no-package-symlinksflag that will stop "packages" directories from being generated at all. -
An issue where HTTP requests were sometimes made even though
--offlinewas passed has been fixed. -
A bug with
--offlinethat caused an unhelpful error message has been fixed. -
Pub will no longer time out when a package takes a long time to download.
-
-
pub publish-
Pub will emit a non-zero exit code when it finds a violation while publishing.
-
.gitignorefiles will be respected even if the package isn't at the top level of the Git repository.
-
-
Barback integration
-
A crashing bug involving transformers that only apply to non-public code has been fixed.
-
A deadlock caused by declaring transformer followed by a lazy transformer (such as the built-in
$dart2jstransformer) has been fixed. -
A stack overflow caused by a transformer being run multiple times on the package that defines it has been fixed.
-
A transformer that tries to read a non-existent asset in another package will now be re-run if that asset is later created.
-
-
-
BREAKING The service protocol now sends JSON-RPC 2.0-compatible server-to-client events. To reflect this, the service protocol version is now 2.0.
-
The service protocol now includes a
"jsonrpc"property in its responses, as opposed to"json-rpc". -
The service protocol now properly handles requests with non-string ids. Numeric ids are no longer converted to strings, and null ids now don't produce a response.
-
Some RPCs that didn't include a
"jsonrpc"property in their responses now include one.
- Fix a bug where
WebSocket.close()would crash if called afterWebSocket.cancel().
- Pub will always load Dart SDK assets from the SDK whose
pubexecutable was run, even if aDART_SDKenvironment variable is set.
-
dart:coreIterableadded anemptyconstructor. dcf0286Iterablecan now be extended directly. An alternative to extendingIterableBasefromdart:collection.Listadded anunmodifiableconstructor. r45334Mapadded anunmodifiableconstructor. r45733intadded agcdmethod. a192ef4intadded amodInversemethod. f6f338cStackTraceadded afromStringconstructor. 68dd6f6Uriadded adirectoryconstructor. d8dbb4a- List iterators may not throw
ConcurrentModificationErroras eagerly in release mode. In checked mode, the modification check is still as eager as possible. r45198
-
dart:developer- NEW- Replaces the deprecated
dart:profilerlibrary. - Adds new functions
debuggerandinspect. 6e42aec
- Replaces the deprecated
-
dart:io -
dart:htmlElementmethods,appendHtmlandinsertAdjacentHtmlnow takenodeValidatorandtreeSanitizerparameters, and the inputs are consistently sanitized. r45818 announcement
-
dart:isolate- BREAKING The positional
priorityparameter ofIsolate.pingandIsolate.killis now a named parameter namedpriority. - BREAKING Removed the
Isolate.AS_EVENTpriority. IsolatemethodspingandaddOnExitListenernow have a named parameterresponse. r45092Isolate.spawnUriadded a named argumentchecked.- Remove the experimental state of the API.
- BREAKING The positional
-
dart:profiler- DEPRECATED- This library will be removed in 1.12. Use
dart:developerinstead.
- This library will be removed in 1.12. Use
- This is the first release that does not include the Eclipse-based Dart Editor. See dartlang.org/tools for alternatives.
- This is the last release that ships the (unsupported)
dart2dart (aka
dart2js --output-type=dart) utility as part of dart2js
-
dart:convert -
dart:coreUri.parseaddedstartandendpositional arguments.
-
dart:html- POTENTIALLY BREAKING
CssClassSetmethod arguments must now be 'tokens', i.e. non-empty strings with no white-space characters. The implementation was incorrect for class names containing spaces. The fix is to forbid spaces and provide a faster implementation. Announcement
- POTENTIALLY BREAKING
-
dart:ioProcessResultnow exposes a constructor.importandIsolate.spawnUrinow supports the Data URI scheme on the VM.
-
Running
pub run foowithin a package now runs thefooexecutable defined by thefoopackage. The previous behavior ranbin/foo. This makes it easy to run binaries in dependencies, for instancepub run test. -
On Mac and Linux, signals sent to
pub runand forwarded to the child command.
This is a bug fix release which merges a number of commits from bleeding_edge.
-
dart2js: Addresses as issue with minified Javascript output with CSP enabled - r44453
-
Editor: Fixes accidental updating of files in the pub cache during rename refactoring - r44677
-
Editor: Fix for issue 23032 regarding skipped breakpoints on Windows - r44824
-
dart:mirrors: Fix
MethodMirror.sourcewhen the method is on the first line in a script - r44957, r44976 -
pub: Fix for issue 23084: Pub can fail to load transformers necessary for local development - r44876
-
Support for
async,await,sync*,async*,yield,yield*, andawait for. See the the language tour for more details. -
Enum support is fully enabled. See the language tour for more details.
-
The formatter is much more comprehensive and generates much more readable code. See its tool page for more details.
-
The analysis server is integrated into the IntelliJ plugin and the Dart editor. This allows analysis to run out-of-process, so that interaction remains smooth even for large projects.
-
Analysis supports more and better hints, including unused variables and unused private members.
-
There's a new model for shared server sockets with no need for a
Socketreference. -
A new, much faster regular expression engine.
-
The Isolate API now works across the VM and
dart2js.
For more information on any of these changes, see the corresponding documentation on the Dart API site.
-
dart:async:-
Future.waitadded a new named argument,cleanUp, which is a callback that releases resources allocated by a successfulFuture. -
The
SynchronousStreamControllerclass was added as an explicit name for the type returned when thesyncargument is passed tonew StreamController.
-
-
dart:collection: Thenew SplayTreeSet.from(Iterable)constructor was added. -
dart:convert:Utf8Encoder.convertandUtf8Decoder.convertadded optionalstartandendarguments. -
dart:core:-
RangeErroradded new static helper functions:checkNotNegative,checkValidIndex,checkValidRange, andcheckValueInInterval. -
intadded themodPowfunction. -
Stringadded thereplaceFirstMappedandreplaceRangefunctions.
-
-
dart:io:-
Support for locking files to prevent concurrent modification was added. This includes the
File.lock,File.lockSync,File.unlock, andFile.unlockSyncfunctions as well as theFileLockclass. -
Support for starting detached processes by passing the named
modeargument (aProcessStartMode) toProcess.start. A process can be fully attached, fully detached, or detached except for its standard IO streams. -
HttpServer.bindandHttpServer.bindSecureadded thev6Onlynamed argument. If this is true, only IPv6 connections will be accepted. -
HttpServer.bind,HttpServer.bindSecure,ServerSocket.bind,RawServerSocket.bind,SecureServerSocket.bindandRawSecureServerSocket.bindadded thesharednamed argument. If this is true, multiple servers or sockets in the same Dart process may bind to the same address, and incoming requests will automatically be distributed between them. -
Deprecation: the experimental
ServerSocketReferenceandRawServerSocketReferenceclasses, as well as getters that returned them, are marked as deprecated. Thesharednamed argument should be used instead. These will be removed in Dart 1.10. -
Socket.connectandRawSocket.connectadded thesourceAddressnamed argument, which specifies the local address to bind when making a connection. -
The static
Process.killPidmethod was added to kill a process with a given PID. -
Stdoutadded thenonBlockinginstance property, which returns a non-blockingIOSinkthat writes to standard output.
-
-
dart:isolate:-
The static getter
Isolate.currentwas added. -
The
IsolatemethodsaddOnExitListener,removeOnExitListener,setErrorsFatal,addOnErrorListener, andremoveOnErrorListenernow work on the VM. -
Isolates spawned via
Isolate.spawnnow allow most objects, including top-level and static functions, to be sent between them.
-
-
Code generation for SIMD on ARM and ARM64 is fixed.
-
A possible crash on MIPS with newer GCC toolchains has been prevented.
-
A segfault when using
rethrowwas fixed (issue 21795).
-
Breakpoints can be set in the Editor using file suffixes (issue 21280).
-
IPv6 addresses are properly handled by
HttpClientindart:io, fixing a crash in pub (issue 21698). -
Issues with the experimental
async/awaitsyntax have been fixed. -
Issues with a set of number operations in the VM have been fixed.
-
ListBaseindart:collectionalways returns anIterablewith the correct type argument.
-
dart:collection:SplayTreeadded thetoSetfunction. -
dart:convert: TheJsonUtf8Encoderclass was added. -
dart:core:-
The
IndexErrorclass was added for errors caused by an index being outside its expected range. -
The
new RangeError.indexconstructor was added. It forwards tonew IndexError. -
RangeErroradded three new properties.invalidPropertyis the value that caused the error, andstartandendare the minimum and maximum values that the value is allowed to assume. -
new RangeError.valueandnew RangeError.rangeadded an optionalmessageargument. -
The
new String.fromCharCodesconstructor added optionalstartandendarguments.
-
-
dart:io:-
Support was added for the Application-Layer Protocol Negotiation extension to the TLS protocol for both the client and server.
-
SecureSocket.connect,SecureServerSocket.bind,RawSecureSocket.connect,RawSecureSocket.secure,RawSecureSocket.secureServer, andRawSecureServerSocket.bindadded asupportedProtocolsnamed argument for protocol negotiation. -
RawSecureServerSocketadded asupportedProtocolsfield. -
RawSecureSocketandSecureSocketadded aselectedProtocolfield which contains the protocol selected during protocol negotiation.
-
-
pubnow generates binstubs for packages that are globally activated so that they can be put on the user'sPATHand used as normal executables. See thepub global activatedocumentation. -
When using
dart2js, deferred loading now works with multiple Dart apps on the same page.
-
dart:async:Zone,ZoneDelegate, andZoneSpecificationadded theerrorCallbackfunction, which allows errors that have been programmatically added to aFutureorStreamto be intercepted. -
dart:io:-
Breaking change:
HttpClient.closemust be called for all clients or they will keep the Dart process alive until they time out. This fixes the handling of persistent connections. Previously, the client would shut down immediately after a request. -
Breaking change:
HttpServerno longer compresses all traffic by default. The newautoCompressproperty can be set totrueto re-enable compression.
-
-
dart:isolate:Isolate.spawnUriadded the optionalpackageRootargument, which controls how it resolvespackage:URIs.