fix(sdk): update dependency dart to >=3.3.0 <4.0.0 #327
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
>=3.2.6 <4.0.0
->>=3.3.0 <4.0.0
Release Notes
dart-lang/sdk (dart)
v3.3.0
Compare Source
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:
The declaration
Meters
is an extension type that has representation typeint
. It introduces an implicit constructorMeters(int value);
and agetter
int get value
.m
andm.value
is the very same object, butm
has type
Meters
andm.value
has typeint
. The point is thatm
has the members of
Meters
andm.value
has the members ofint
.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
, theno
is just a normal object whoserun-time type is a subtype of
R
, exactly like the value of an expressionof type
R
. Also the run-time value ofE
isR
(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 actuallychecks 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:
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
noSuchMethod
forwarding getters with the same name in the same library.This makes the implementation more consistent and allows
type promotion in a few rare scenarios where it wasn't previously allowed.
It is unlikely, but this change could cause a breakage by changing
an inferred type in a way that breaks later code. For example:
Affected code can be fixed by adding an explicit type annotation.
For example, in the above snippet,
var x
can 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_assertion
unnecessary_cast
invalid_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.fromCharCodes
now allowstart
andend
to be after the end ofthe
Iterable
argument, just likeskip
andtake
does on anIterable
.dart:ffi
@Native
can now be used on fields.Native.addressOf
.elementAt
pointer arithmetic extension methods oncore
Pointer
types are now deprecated.Migrate to the new
-
and+
operators instead.@FfiNative
annotation has been removed.Usages should be updated to use the
@Native
annotation.dart:js_interop
like
JSAny
were previously represented using a custom erasure of@staticInterop
types that were compiler-specific. They are now representedas extension types where their representation types are compiler-specific.
This means that user-defined
@staticInterop
types that implementedJSAny
or
JSObject
can no longer do so and need to useJSObject.fromInteropObject
. Going forward, it's recommended to use extensiontypes to define interop APIs. Those extension types can still implement JS
types.
JSArray
andJSPromise
are now generictypes whose type parameter is a subtype of
JSAny?
. Conversions to and fromthese types are changed to account for the type parameters of the Dart or JS
type, respectively.
dart:js_interop
extensionmembers are moved to different extensions on the same type or a supertype to
better organize the API surface. See
JSAnyUtilityExtension
andJSAnyOperatorExtension
for the new extensions. This shouldn't make adifference unless the extension names were explicitly used.
importModule
to allow users to dynamically import modules using the JSimport()
expression.dart:js_interop_unsafe
has
helper to makehasProperty
calls 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.
use the new
asUnmodifiableView()
methods: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
base
sothat 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
dart create
command now uses v3 ofpackage:lints
,including multiple new recommended lints by default.
To learn more about the updated collection of lints,
check out the
package:lints
3.0.0 changelog entry.Wasm compiler (dart2wasm)
dart:js_util
,package:js
, anddart:js
are now disallowed from being imported when compiling with
dart2wasm
. Preferusing
dart:js_interop
anddart:js_interop_unsafe
.Development JavaScript compiler (DDC)
Type arguments of
package:js
interop types are now printed asany
insteadof 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)
The
Invocation
that is passed tonoSuchMethod
will no longer have aminified
memberName
, even when dart2js is invoked with--minify
.See #54201 for more details.
Analyzer
pubspec.yaml
files byadding an
# ignore: <diagnostic_id>
comment.dart doc
comment directives are now reported.flutter_style_todos
][flutter_style_todos] lint now has a quick fix.Linter
iterable_contains_unrelated_type
andlist_remove_unrelated_type
lints.Consider migrating to the expanded
[
collection_methods_unrelated_type
][collection_methods_unrelated_type] lint.always_require_non_null_named_parameters
avoid_returning_null
,avoid_returning_null_for_future
Configuration
📅 Schedule: Branch creation - "after 6pm every weekday,every weekend" in timezone Australia/Sydney, Automerge - "after 6pm every weekday,every weekend" in timezone Australia/Sydney.
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.