stacked
stacked copied to clipboard
chore(deps): update dependency dart to v3
This PR contains the following updates:
| Package | Update | Change |
|---|---|---|
| dart (source) | major | >=2.17.0 <3.0.0 -> <4.0.0 |
Release Notes
dart-lang/sdk (dart)
v3.5.2
v3.5.1
v3.5.0
Language
-
Breaking Change #55418: 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. This change is not expected to make any difference in practice. -
Breaking Change #55436: 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. change is expected to have low impact on real-world code. But in principle it could cause compile-time errors or changes in runtime behavior by changing inferred types. The old behavior can be restored by supplying explicit types.
Libraries
dart:core
- Breaking Change #44876:
DateTimeon the web platform now stores microseconds. The web implementation is now practically compatible with the native implementation, where it is possible to round-trip a timestamp in microseconds through aDateTimevalue without rounding the lower digits. This change might be breaking for apps that rely in some way on the.microsecondcomponent always being zero, for example, expecting only three fractional second digits in thetoString()representation. Small discrepancies in arithmetic due to rounding of web integers may still occur for extreme values, (1)microsecondsSinceEpochoutside the safe range, corresponding to dates with a year outside of 1685..2255, and (2) arithmetic (add,subtract,difference) where theDurationargument or result exceeds 570 years.
dart:io
-
Breaking Change #55786:
SecurityContextis nowfinal. This means thatSecurityContextcan no longer be subclassed.SecurityContextsubclasses were never able to interoperate with other parts ofdart:io. -
A
ConnectionTaskcan now be created using an existingFuture<Socket>. Fixes #55562.
dart:typed_data
-
Breaking Change #53785: The unmodifiable view classes for typed data have been removed. These classes were deprecated in Dart 3.4.
To create an unmodifiable view of a typed-data object, use the
asUnmodifiableView()methods added in Dart 3.3. -
Added superinterface
TypedDataListto typed data lists, implementing bothListandTypedData. Allows abstracting over all such lists without losing access to either theListor theTypedDatamembers. AByteDatais still only aTypedData, not a list.
dart:js_interop
-
Breaking Change #55508:
importModulenow accepts aJSAnyinstead of aStringto support other JS values as well, likeTrustedScriptURLs. -
Breaking Change #55267:
isTruthyandnotnow returnJSBooleaninstead ofboolto be consistent with the other operators. -
Breaking Change
ExternalDartReferenceno longer implementsObject.ExternalDartReferencenow accepts a type parameterTwith a bound ofObject?to capture the type of the Dart object that is externalized.ExternalDartReferenceToObject.toDartObjectnow returns aT.ExternalDartReferenceToObjectandObjectToExternalDartReferenceare now extensions onTandExternalDartReference<T>, respectively, whereT extends Object?. See #55342 and #55536 for more details. -
Fixed some consistency issues with
Function.toJSacross all compilers. Specifically, callingFunction.toJSon the same function gives you a new JS function (see issue #55515), the maximum number of arguments that are passed to the JS function is determined by the static type of the Dart function, and extra arguments are dropped when passed to the JS function in all compilers (see #48186).
Tools
Linter
- Added the [
unintended_html_in_doc_comment][unintended_html_in_doc_comment] lint. - Added the [
invalid_runtime_check_with_js_interop_types][invalid_runtime_check_with_js_interop_types] lint. - Added the [
document_ignores][document_ignores] lint.
Pub
- New flag
dart pub downgrade --tightento restrict lower bounds of dependencies' constraints to the minimum that can be resolved.
Dart Runtime
-
The Dart VM only executes sound null safe code, running of unsound null safe code using the option
--no-sound-null-safetyhas been removed. -
Dart_NewListOfandDart_IsLegacyTypefunctions are removed from Dart C API. -
Dart_DefaultCanonicalizeUrlis removed from the Dart C API.
v3.4.4
v3.4.3
v3.4.2
v3.4.1
v3.4.0
Language
Dart 3.4 makes improvements to the type analysis of conditional expressions
(e1 ? e2 : e3), if-null expressions (e1 ?? e2), if-null assignments
(e1 ??= e2), and switch expressions (switch (e) { p1 => e1, ... }). To take
advantage of these improvements, set your package's
SDK constraint lower bound to 3.4 or greater
(sdk: '^3.4.0').
-
Breaking Change #54640: The pattern context type schema for cast patterns has been changed from
Object?to_(the unknown type), to align with the specification. This change is not expected to make any difference in practice. -
Breaking Change #54828: The type schema used by the compiler front end to perform type inference on the operand of a null-aware spread operator (
...?) in map and set literals has been made nullable, to match what currently happens in list literals. This makes the compiler front end behavior consistent with that of the analyzer. This change is expected to be very low impact.
Libraries
dart:async
- Added option for
ParallelWaitErrorto get some meta-information that it can expose in itstoString, and theIterable<Future>.waitand(Future,...,Future).waitextension methods now provide that information. Should make aParallelWaitErroreasier to log.
dart:cli
- Breaking change [#52121][]:
waitForis removed in 3.4.
dart:ffi
- Added
Struct.createandUnion.createto create struct and union views of the sequence of bytes stored in a subtype ofTypedData.
dart:io
-
Breaking change #53863:
Stdouthas a new fieldlineTerminator, which allows developers to control the line ending used bystdoutandstderr. Classes thatimplement Stdoutmust define thelineTerminatorfield. The default semantics ofstdoutandstderrare not changed. -
Deprecates
FileSystemDeleteEvent.isDirectory, which always returnsfalse.
dart:js_interop
-
Fixes an issue with several comparison operators in
JSAnyOperatorExtensionthat were declared to returnJSBooleanbut really returnedbool. This led to runtime errors when trying to use the return values. The implementation now returns aJSBooleanto align with the interface. See issue #55024 for more details. -
Added
ExternalDartReferenceand related conversion functionstoExternalReferenceandtoDartObject. This is a faster alternative toJSBoxedDartObject, but with fewer safety guarantees and fewer interoperability capabilities. See #55187 for more details. -
On dart2wasm,
JSBoxedDartObjectnow is an actual JS object that wraps the opaque Dart value instead of only externalizing the value. Like the JS backends, you'll now get a more useful error when trying to use it in another Dart runtime. -
Added
isAhelper to make type checks easier with interop types. See #54138 for more details.
dart:typed_data
-
BREAKING CHANGE #53218 #53785: The unmodifiable view classes for typed data are deprecated.
To create an unmodifiable view of a typed-data object, use the
asUnmodifiableView()methods added in Dart 3.3:Uint8List data = ...; final readOnlyView = data.asUnmodifiableView(); // readOnlyView has type Uint8List, and throws if attempted modified.The reason for this change is to allow more flexibility in the implementation of typed data, so the native and web platforms can use different strategies to ensure that typed data has good performance.
The deprecated types will be removed in Dart 3.5.
Tools
Analyzer
-
Improved code completion. Fixed over 50% of completion correctness bugs, tagged
analyzer-completion-correctnessin the issue tracker. -
Support for new annotations introduced in version 1.14.0 of the meta package.
-
Support for the [
@doNotSubmit][@doNotSubmit] annotation, noting that any usage of an annotated member should not be submitted to source control. -
Support for the [
@mustBeConst][@mustBeConst] annotation, which indicates that an annotated parameter only accepts constant arguments.
-
Linter
- Added the [
unnecessary_library_name][unnecessary_library_name] lint. - Added the [
missing_code_block_language_in_doc_comment][missing_code_block_language_in_doc_comment] lint.
Compilers
- The compilation environment will no longer pretend to contain entries with
value
""for alldart.library.foostrings, wheredart:foois not an available library. Instead there will only be entries for the available libraries, likedart.library.core, where the value was, and still is,"true". This should have no effect onconst bool.fromEnvironment(...)orconst String.fromEnvironment(...)without adefaultValueargument, an argument which was always ignored previously. It changes the behavior ofconst bool.hasEnvironment(...)on such an input, away from always beingtrueand therefore useless.
DevTools
- Updated DevTools to version 2.33.0 from 2.31.1. To learn more, check out the release notes for versions 2.32.0 and 2.33.0.
Pub
-
Dependency resolution and
dart pub outdatedwill now surface if a dependency is affected by a security advisory, unless the advisory is listed under aignored_advisoriessection in thepubspec.yamlfile. To learn more about pub's support for security advisories, visit dart.dev/go/pub-security-advisories. -
path-dependencies insidegit-dependencies are now resolved relative to the git repo. -
All
dart pubcommands can now be run from any subdirectory of a project. Pub will find the first parent directory with apubspec.yamland operate relative it. -
New command
dart pub unpackthat downloads a package from pub.dev and extracts it to a subfolder of the current directory.This can be useful for inspecting the code, or playing with examples.
Dart Runtime
-
Dart VM flags and options can now be provided to any executable generated using
dart compile exevia theDART_VM_OPTIONSenvironment variable.DART_VM_OPTIONSshould be set to a list of comma-separated flags and options with no whitespace. Options that allow for multiple values to be provided as comma-separated values are not supported (e.g.,--timeline-streams=Dart,GC,Compiler).Example of a valid
DART_VM_OPTIONSenvironment variable:DART_VM_OPTIONS=--random_seed=42,--verbose_gc -
Dart VM no longer supports external strings:
Dart_IsExternalString,Dart_NewExternalLatin1StringandDart_NewExternalUTF16Stringfunctions are removed from Dart C API.
v3.3.4
This is a patch release that:
- Fixes an issue with JS interop in dart2wasm where JS interop methods that used
the enclosing library's
@JSannotation were actually using the invocation's enclosing library's@JSannotation. (issue #55430).
v3.3.3
This is a patch release that:
- Fixes an issue where dart vm crashed when running on pre-SSE41 older CPUs on Windows (issue #55211).
v3.3.2
This is a patch release that:
- Fixes an issue in the CFE that placed some structural parameter references out of their context in the code restored from dill files, causing crashes in the incremental compiler whenever it restored a typedef from dill such that the typedef contained a generic function type on its right-hand side (issue #55158).
- Fixes an issue in the CFE that prevented redirecting factories from being resolved in initializers of extension types (issue #55194).
- Fixes an issues with VM's implementation of
DateTime.timeZoneNameon Windows, which was checking whether current date is in the summer or standard time rather than checking if the given moment is in the summer or standard time (issue #55240).
v3.3.1
This is a patch release that:
- Fixes an issue in dart2js where object literal constructors in interop
extension types would fail to compile without an
@JSannotation on the library (issue #55057). - Disallows certain types involving extension types from being used as the
operand of an
awaitexpression, unless the extension type itself implementsFuture(issue #55095).
v3.3.0
Language
Dart 3.3 adds extension types to the language. To use them, set your
package's [SDK constraint][language version] lower bound to 3.3 or greater
(sdk: '^3.3.0').
Extension types
An extension type wraps an existing type with a different, static-only interface. It works in a way which is in many ways similar to a class that contains a single final instance variable holding the wrapped object, but without the space and time overhead of an actual wrapper object.
Extension types are introduced by extension type declarations. Each such declaration declares a new named type (not just a new name for the same type). It declares a representation variable whose type is the representation type. The effect of using an extension type is that the representation (that is, the value of the representation variable) has the members declared by the extension type rather than the members declared by its "own" type (the representation type). Example:
extension type Meters(int value) {
String get label => '${value}m';
Meters operator +(Meters other) => Meters(value + other.value);
}
void main() {
var m = Meters(42); // Has type `Meters`.
var m2 = m + m; // OK, type `Meters`.
// int i = m; // Compile-time error, wrong type.
// m.isEven; // Compile-time error, no such member.
assert(identical(m, m.value)); // Succeeds.
}
The declaration Meters is an extension type that has representation type
int. It introduces an implicit constructor Meters(int value); and a
getter int get value. m and m.value is the very same object, but m
has type Meters and m.value has type int. The point is that m
has the members of Meters and m.value has the members of int.
Extension types are entirely static, they do not exist at run time. If o
is the value of an expression whose static type is an extension type E
with representation type R, then o is just a normal object whose
run-time type is a subtype of R, exactly like the value of an expression
of type R. Also the run-time value of E is R (for example, E == R
is true). In short: At run time, an extension type is erased to the
corresponding representation type.
A method call on an expression of an extension type is resolved at compile-time, based on the static type of the receiver, similar to how extension method calls work. There is no virtual or dynamic dispatch. This, combined with no memory overhead, means that extension types are zero-cost wrappers around their representation value.
While there is thus no performance cost to using extension types, there is
a safety cost. Since extension types are erased at compile time, run-time
type tests on values that are statically typed as an extension type will
check the type of the representation object instead, and if the type check
looks like it tests for an extension type, like is Meters, it actually
checks for the representation type, that is, it works exactly like is int
at run time. Moreover, as mentioned above, if an extension type is used as
a type argument to a generic class or function, the type variable will be
bound to the representation type at run time. For example:
void main() {
var meters = Meters(3);
// At run time, `Meters` is just `int`.
print(meters is int); // Prints "true".
print(<Meters>[] is List<int>); // Prints "true".
// An explicit cast is allowed and succeeds as well:
List<Meters> meterList = <int>[1, 2, 3] as List<Meters>;
print(meterList[1].label); // Prints "2m".
}
Extension types are useful when you are willing to sacrifice some run-time encapsulation in order to avoid the overhead of wrapping values in instances of wrapper classes, but still want to provide a different interface than the wrapped object. An example of that is interop, where you may have data that are not Dart objects to begin with (for example, raw JavaScript objects when using JavaScript interop), and you may have large collections of objects where it's not efficient to allocate an extra object for each element.
Other changes
-
Breaking Change #54056: The rules for private field promotion have been changed so that an abstract getter is considered promotable if there are no conflicting declarations. There are no conflicting declarations if there are no non-final fields, external fields, concrete getters, or
noSuchMethodforwarding getters with the same name in the same library. This makes the implementation more consistent and allows type promotion in a few rare scenarios where it wasn't previously allowed. It is unlikely, but this change could cause a breakage by changing an inferred type in a way that breaks later code. For example:class A { int? get _field; } class B extends A { final int? _field; B(this._field); } test(A a) { if (a._field != null) { var x = a._field; // Previously had type `int?`; now has type `int` ... x = null; // Previously allowed; now causes a compile-time error. } }Affected code can be fixed by adding an explicit type annotation. For example, in the above snippet,
var xcan be changed toint? x.It's also possible that some continuous integration configurations might fail if they have been configured to treat warnings as errors, because the expanded type promotion could lead to one of the following warnings:
unnecessary_non_null_assertionunnecessary_castinvalid_null_aware_operator
These warnings can be addressed in the usual way, by removing the unnecessary operation in the first two cases, or changing
?.to.in the third case.To learn more about other rules surrounding type promotion, check out the guide on Fixing type promotion failures.
Libraries
dart:core
String.fromCharCodesnow allowstartandendto be after the end of theIterableargument, just likeskipandtakedoes on anIterable.
dart:ffi
- In addition to functions,
@Nativecan now be used on fields. - Allow taking the address of native functions and fields via
Native.addressOf. - The
elementAtpointer arithmetic extension methods on corePointertypes are now deprecated. Migrate to the new-and+operators instead. - The experimental and deprecated
@FfiNativeannotation has been removed. Usages should be updated to use the@Nativeannotation.
dart:js_interop
- Breaking Change in the representation of JS types #52687: JS types
like
JSAnywere previously represented using a custom erasure of@staticInteroptypes that were compiler-specific. They are now represented as extension types where their representation types are compiler-specific. This means that user-defined@staticInteroptypes that implementedJSAnyorJSObjectcan no longer do so and need to useJSObject.fromInteropObject. Going forward, it's recommended to use extension types to define interop APIs. Those extension types can still implement JS types. - JSArray and JSPromise generics:
JSArrayandJSPromiseare now generic types whose type parameter is a subtype ofJSAny?. Conversions to and from these types are changed to account for the type parameters of the Dart or JS type, respectively. - Breaking Change in names of extensions: Some
dart:js_interopextension members are moved to different extensions on the same type or a supertype to better organize the API surface. SeeJSAnyUtilityExtensionandJSAnyOperatorExtensionfor the new extensions. This shouldn't make a difference unless the extension names were explicitly used. - Add
importModuleto allow users to dynamically import modules using the JSimport()expression.
dart:js_interop_unsafe
- Add
hashelper to makehasPropertycalls more concise.
dart:typed_data
-
BREAKING CHANGE (https://github.com/dart-lang/sdk/issues/53218) The unmodifiable view classes for typed data are deprecated. Instead of using the constructors for these classes to create an unmodifiable view, e.g.
Uint8List data = ... final readOnlyView = UnmodifiableUint8ListView(data);use the new
asUnmodifiableView()methods:Uint8List data = ... final readOnlyView = data.asUnmodifiableView();The reason for this change is to allow more flexibility in the implementation of typed data so the native and web platforms can use different strategies for ensuring typed data has good performance.
The deprecated types will be removed in a future Dart version.
dart:nativewrappers
- Breaking Change #51896: The NativeWrapperClasses are marked
baseso that none of their subtypes can be implemented. Implementing subtypes can lead to crashes when passing such native wrapper to a native call, as it will try to unwrap a native field that doesn't exist.
Tools
Dart command line
- The
dart createcommand now uses v3 ofpackage:lints, including multiple new recommended lints by default. To learn more about the updated collection of lints, check out thepackage:lints3.0.0 changelog entry.
DevTools
- Updated DevTools to version 2.31.1 from 2.28.1. To learn more, check out the release notes for versions 2.29.0, 2.30.0, and 2.31.0.
Wasm compiler (dart2wasm)
- Breaking Change #54004:
dart:js_util,package:js, anddart:jsare now disallowed from being imported when compiling withdart2wasm. Prefer usingdart:js_interopanddart:js_interop_unsafe.
Development JavaScript compiler (DDC)
-
Type arguments of
package:jsinterop types are now printed asanyinstead of being omitted. This is simply a change to the textual representation of package js types that have type arguments. These type arguments are still completely ignored by the type system at runtime. -
Removed "implements <...>" text from the Chrome custom formatter display for Dart classes. This information provides little value and keeping it imposes an unnecessary maintenance cost.
Production JavaScript compiler (dart2js)
- Breaking Change #54201:
The
Invocationthat is passed tonoSuchMethodwill no longer have a minifiedmemberName, even when dart2js is invoked with--minify. See #54201 for more details.
Analyzer
- You can now suppress diagnostics in
pubspec.yamlfiles by adding an# ignore: <diagnostic_id>comment. - Invalid
dart doccomment directives are now reported. - The [
flutter_style_todos][flutter_style_todos] lint now has a quick fix.
Linter
- Removed the
iterable_contains_unrelated_typeandlist_remove_unrelated_typelints. Consider migrating to the expanded [collection_methods_unrelated_type][collection_methods_unrelated_type] lint. - Removed various lints that are no longer necessary with sound null safety:
always_require_non_null_named_parametersavoid_returning_null,avoid_returning_null_for_future
v3.2.6
v3.2.5
v3.2.4
v3.2.3
This is a patch release that:
- Disallows final fields to be used in a constant context during analysis (issue #54232).
- Upgrades Dart DevTools to version 2.28.4 (issue #54213).
- Fixes new AOT snapshots in the SDK failing with SIGILL in ARM environments that don't support the integer division instructions or x86-64 environments that don't support SSE4.1 (issue #54215).
v3.2.2
This is a patch release that:
-
Adjusts the nullablity computations in the implementation of the upper bound algorithm in the compiler frontend (issue #53999).
-
Fixes missing closure code completion entries for function parameters for LSP-based editors like VS Code (issue #54112).
v3.2.1
This is a patch release that:
-
Fixes the left/mobile sidebar being empty on non-class pages in documentation generated with
dart doc(issue #54073). -
Fixes a JSON array parsing bug that causes a segmentation fault when
flutter testis invoked with the--coverageflag (SDK issue #54059, Flutter issue #124145). -
Upgrades Dart DevTools to version 2.28.3 (issue #54085).
v3.2.0
Language
Dart 3.2 adds the following features. To use them, set your package's SDK
constraint lower bound to 3.2 or greater (sdk: '^3.2.0').
-
Private field promotion: In most circumstances, the types of private final fields can now be promoted by null checks and
istests. For example:class Example { final int? _privateField; Example(this._privateField); f() { if (_privateField != null) { // _privateField has now been promoted; you can use it without // null checking it. int i = _privateField; // OK } } } // Private field promotions also work from outside of the class: f(Example x) { if (x._privateField != null) { int i = x._privateField; // OK } }To ensure soundness, a field is not eligible for field promotion in the following circumstances:
- If it's not final (because a non-final field could be changed in between the test and the usage, invalidating the promotion).
- If it's overridden elsewhere in the library by a concrete getter or a non-final field (because an access to an overridden field might resolve at runtime to the overriding getter or field).
- If it's not private (because a non-private field might be overridden elsewhere in the program).
- If it has the same name as a concrete getter or a non-final field in some other unrelated class in the library (because a class elsewhere in the program might extend one of the classes and implement the other, creating an override relationship between them).
- If there is a concrete class
Cin the library whose interface contains a getter with the same name, butCdoes not have an implementation of that getter (such unimplemented getters aren't safe for field promotion, because they are implicitly forwarded tonoSuchMethod, which might not return the same value each time it's called).
-
Breaking Change #53167: Use a more precise split point for refutable patterns. Previously, in an if-case statement, if flow analysis could prove that the scrutinee expression was guaranteed to throw an exception, it would sometimes fail to propagate type promotions implied by the pattern to the (dead) code that follows. This change makes the type promotion behavior of if-case statements consistent regardless of whether the scrutinee expression throws an exception.
No live code is affected by this change, but there is a small chance that the change in types will cause a compile-time error to appear in some dead code in the user's project, where no compile-time error appeared previously.
Libraries
dart:async
- Added
broadcastparameter toStream.emptyconstructor.
dart:cli
- Breaking change #52121:
waitForis disabled by default and slated for removal in 3.4. Attempting to call this function will now throw an exception. Users that still depend onwaitForcan enable it by passing--enable_deprecated_wait_forflag to the VM.
dart:convert
- Breaking change #52801:
- Changed return types of
utf8.encode()andUtf8Codec.encode()fromList<int>toUint8List.
- Changed return types of
dart:developer
- Deprecated the
Service.getIsolateIDmethod. - Added
getIsolateIdmethod toService. - Added
getObjectIdmethod toService.
dart:ffi
- Added the
NativeCallable.isolateLocalconstructor. This createsNativeCallables with the same functionality asPointer.fromFunction, except thatNativeCallableaccepts closures. - Added the
NativeCallable.keepIsolateAlivemethod, which determines whether theNativeCallablekeeps the isolate that created it alive. - All
NativeCallableconstructors can now accept closures. PreviouslyNativeCallables had the same restrictions asPointer.fromFunction, and could only create callbacks for static functions. - Breaking change #53311:
NativeCallable.nativeFunctionnow throws an error if is called after theNativeCallablehas already beenclosed. Calls tocloseafter the first are now ignored.
dart:io
-
Breaking change #53005: The headers returned by
HttpClientResponse.headersandHttpRequest.headersno longer include trailing whitespace in their values. -
Breaking change #53227: Folded headers values returned by
HttpClientResponse.headersandHttpRequest.headersnow have a space inserted at the fold point.
dart:isolate
- Added
Isolate.packageConfigSyncandIsolate.resolvePackageUriSyncAPIs.
dart:js_interop
- Breaking Change on JSNumber.toDart and Object.toJS:
JSNumber.toDartis removed in favor oftoDartDoubleandtoDartIntto make the type explicit.Object.toJSis also removed in favor ofObject.toJSBox. Previously, this function would allow Dart objects to flow into JS unwrapped on the JS backends. Now, there's an explicit wrapper that is added and unwrapped viaJSBoxedDartObject.toDart. Similarly,JSExportedDartObjectis renamed toJSBoxedDartObjectand the extensionsObjectToJSExportedDartObjectandJSExportedDartObjectToObjectare renamed toObjectToJSBoxedDartObjectandJSBoxedDartObjectToObjectin order to avoid confusion with@JSExport. - Type parameters in external APIs:
Type parameters must now be bound to a static interop type or one of the
dart:js_interoptypes likeJSNumberwhen used in an external API. This only affectsdart:js_interopclasses and notpackage:jsor other forms of JS interop. - Subtyping
dart:js_interoptypes:@staticInteroptypes can subtype onlyJSObjectandJSAnyfrom the set of JS types indart:js_interop. Subtyping other types fromdart:js_interopwould result in confusing type errors before, so this makes it a static error. - Global context of
dart:js_interopand@staticInteropAPIs: Static interop APIs will now use the same global context as non-static interop instead ofglobalThisto avoid a greater migration. Static interop APIs, either throughdart:js_interopor the@staticInteropannotation, have used JavaScript'sglobalThisas the global context. This is relevant to things like external top-level members or external constructors, as this is the root context we expect those members to reside in. Historically, this was not the case in dart2js and DDC. We used eitherselfor DDC'sglobalin non-static interop APIs withpackage:js. So, static interop APIs will now use one of those global contexts. Functionally, this should matter in only a very small number of cases, like when using older browser versions.dart:js_interop'sglobalJSObjectis also renamed toglobalContextand returns the global context used in the lowerings. - Breaking Change on Types of
dart:js_interopExternal APIs: External JS interop APIs when usingdart:js_interopare restricted to a set of allowed types. Namely, this includes the primitive types likeString, JS types fromdart:js_interop, and other static interop types (either through@staticInteropor extension types). - Breaking Change on
dart:js_interopisNullandisUndefined:nullandundefinedcan only be discerned in the JS backends. dart2wasm conflates the two values and treats them both as Dart null. Therefore, these two helper methods should not be used on dart2wasm and will throw to avoid potentially erroneous code. - Breaking Change on
dart:js_interoptypeofEqualsandinstanceof: Both APIs now return aboolinstead of aJSBoolean.typeofEqualsalso now takes in aStringinstead of aJSString. - Breaking Change on
dart:js_interopJSAnyandJSObject: These types can only be implemented, and no longer extended, by user@staticInteroptypes. - Breaking Change on
dart:js_interopJSArray.withLength: This API now takes in anintinstead ofJSNumber.
Tools
Development JavaScript compiler (DDC)
- Applications compiled by DDC will no longer add members to the native JavaScript Object prototype.
- Breaking change for JS interop with Symbols and BigInts:
JavaScript
Symbols andBigInts are now associated with their own interceptor and should not be used withpackage:jsclasses. These types were being intercepted with the assumption that they are a subtype of JavaScript'sObject, but this is incorrect. This lead to erroneous behavior when using these types as DartObjects. See #53106 for more details. Usedart:js_interop'sJSSymbolandJSBigIntwith extension types to interop with these types.
Production JavaScript compiler (dart2js)
- Breaking change for JS interop with Symbols and BigInts:
JavaScript
Symbols andBigInts are now associated with their own interceptor and should not be used withpackage:jsclasses. These types were being intercepted with the assumption that they are a subtype of JavaScript'sObject, but this is incorrect. This lead to erroneous behavior when using these types as DartObjects. See #53106 for more details. Usedart:js_interop'sJSSymbolandJSBigIntwith extension types to interop with these types.
Dart command line
- The
dart createcommand has a newclitemplate to quickly create Dart command-line applications with basic argument parsing capabilities. To learn more about using the template, rundart help create.
Dart format
- Always split enum declarations containing a line comment.
- Fix regression in splitting type annotations with library prefixes.
- Support
--enable-experimentcommand-line option to enable language experiments.
DevTools
Linter
- Added the experimental [
annotate_redeclares][annotate_redeclares] lint. - Marked the [
use_build_context_synchronously][use_build_context_synchronously] lint as stable.
Pub
- New option
dart pub upgrade --tightenwhich will update dependencies' lower bounds inpubspec.yamlto match the current version. - The commands
dart pub get/add/upgradewill now show if a dependency changed between direct, dev and transitive dependency. - The command
dart pub upgradeno longer shows unchanged dependencies.
v3.1.5
This is a patch release that:
- Fixes an issue affecting Dart compiled to JavaScript running in Node.js 21. A change in Node.js 21 affected the Dart Web compiler runtime. This patch release accommodates for those changes (issue #53810).
v3.1.4
This is a patch release that:
- Fixes an issue in the Dart VM, users are not being able to see value of variables while debugging code (issue [#53747]).
v3.1.3
This is a patch release that:
-
Fixes a bug in dart2js which would cause the compiler to crash when using
@staticInterop@anonymousfactory constructors with type parameters (see issue #53579 for more details). -
The standalone Dart VM now exports symbols only for the Dart_* embedding API functions, avoiding conflicts with other DSOs loaded into the same process, such as shared libraries loaded through
dart:ffi, that may have different versions of the same symbols (issue [#53503]). -
Fixes an issue with super slow access to variables while debugging. The fix avoids searching static functions in the imported libraries as references to members are fully resolved by the front-end. (issue #53541)
v3.1.2
This is a patch release that:
-
Fixes a bug in dart2js which crashed the compiler when a typed record pattern was used outside the scope of a function body, such as in a field initializer. For example
final x = { for (var (int a,) in someList) a: a };(issue #53449) -
Fixes an expedient issue of users seeing an unhandled exception pause in the debugger, please https://github.com/dart-lang/sdk/issues/53450es/53450 for more details. The fix uses try/catch in lookupAddresses instead of Future error so that we don't see an unhandled exception pause in the debugger (issue #53450)
v3.1.1
This is a patch release that:
- Fixes a bug in the parser which prevented a record pattern from containing a
nested record pattern, where the nested record pattern uses record
destructuring shorthand syntax, for example
final ((:a, :b), c) = record;(issue #53352).
v3.1.0
Libraries
dart:async
- Breaking change #52334:
- Added the
interfacemodifier to purely abstract classes:MultiStreamController,StreamConsumer,StreamIteratorandStreamTransformer. As a result, these types can only be implemented, not extended or mixed in.
- Added the
dart:core
Uri.baseon native platforms now respectsIOOverridesoverriding current directory (#39796).
dart:ffi
- Added the
NativeCallableclass, which can be used to create callbacks that allow native code to call into Dart code from any thread. SeeNativeCallable.listener. In future releases,NativeCallablewill be updated with more functionality, and will become the recommended way of creating native callbacks for all use cases, replacingPointer.fromFunction.
dart:io
- Breaking change #51486:
- Added
sameSiteto theCookieclass. - Added class
SameSite.
- Added
- Breaking change #52027:
FileSystemEventissealed. This means thatFileSystemEventcannot be extended or implemented. - Added a deprecation warning when
Platformis instantiated. - Added
Platform.lineTerminatorwhich exposes the character or characters that the operating system uses to separate lines of text, e.g.,"\r\n"on Windows.
dart:js_interop
- Object literal constructors:
ObjectLiteralis removed fromdart:js_interop. It's no longer needed in order to declare an object literal constructor with inline classes. As long as an external constructor has at least one named parameter, it'll be treated as an object literal constructor. If you want to create an object literal with no named members, use{}.jsify().
Other libraries
package:js
- Breaking change to
@staticInteropandexternalextension members:external@staticInteropmembers andexternalextension members can no longer be used as tear-offs. Declare a closure or a non-externalmethod that calls these members, and use that instead. - Breaking change to
@staticInteropandexternalextension members:external@staticInteropmembers andexternalextension members will generate slightly different JS code for methods that have optional parameters. Whereas before, the JS code passed in the default value for missing optionals, it will now pass in only the provided members. This aligns with how JS parameters work, where omitted parameters are actually omitted. For example, callingexternal void foo([int a, int b])asfoo(0)will now result infoo(0), and notfoo(0, null).
Tools
DevTools
Linter
- Added new static analysis lints you can enable in
your package's
analysis_options.yamlfile:
v3.0.7
This is a patch release that:
- Fixes a bug in dart2js which would cause certain uses of records to lead to
bad codegen causing a
TypeErrororNoSuchMethodErrorto be thrown at runtime (issue #53001).
v3.0.6
This is a patch release that:
- Fixes a flow in flow analysis that causes it to sometimes ignore destructuring assignments (issue #52767).
- Fixes an infinite loop in some web development compiles that include
isorasexpressions involving record types with named fields (issue #52869). - Fixes a memory leak in Dart analyzer's file-watching (issue #52791).
- Fixes a memory leak of file system watcher related data structures (issue #52793).
v3.0.5
This is a patch release that:
- Fixes a bad cast in the frontend which can manifest as a crash in the dart2js
ListFactorySpecializerduring Flutter web builds (issue #52403).
v3.0.4
This is a patch release that:
dart formatnow handles formatting nullable record types with no fields (dart_style issue #1224).- Fixes error when using records when targeting the web in development mode (issue #52480).
v3.0.3
This is a patch release that:
- Fixes an AOT compiler crash when generating an implicit getter returning an unboxed record (issue #52449).
- Fixes a situation in which variables appearing in multiple branches of an or-pattern might be erroneously reported as being mismatched (issue #52373).
- Adds missing
interfacemodifiers on the purely abstract classesMultiStreamController,StreamConsumer,StreamIteratorandStreamTransformer(issue #52334). - Fixes an error during debugging when
InternetAddress.tryParseis used (issue #52423). - Fixes a VM issue causing crashes on hot reload (issue #126884).
- Improves linter support (issue #4195).
- Fixes an issue in variable patterns preventing users from expressing a pattern match using a variable or wildcard pattern with a nullable record type (issue #52439).
- Updates warnings and provide instructions for updating the Dart pub cache on Windows (issue #52386).
v3.0.2
This is a patch release that:
- Fixes a dart2js crash when using a switch case expression on a record where the fields don't match the cases (issue #52438).
- Add class modifier chips on class and mixin pages
generated with
dart doc(issue #3392). - Fixes a situation causing the parser to fail resulting in an infinite loop leading to higher memory usage (issue #52352).
- Add clear errors when mixing inheritance in pre and post Dart 3 libraries (issue: #52078).
v3.0.1
This is a patch release that:
- Fixes a compiler crash involving redirecting factories and FFI (issue [#124369]).
- Fixes a dart2js crash when using a combination of local functions, generics, and records (issue [#
Configuration
📅 Schedule: Branch creation - "after 9pm,before 6am" in timezone Africa/Johannesburg, Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
- [ ] If you want to rebase/retry this PR, check this box
This PR was generated by Mend Renovate. View the repository job log.