Skip to content

chore(deps): update dependency dart to v3 #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Aug 22, 2023

This PR contains the following updates:

Package Update Change
dart (source) major >=2.7.0 <3.0.0 -> <4.0.0

Release Notes

dart-lang/sdk (dart)

v3.7.0

Compare Source

Released on: 2025-02-12

Language

Dart 3.7 adds wildcard variables to the language. To use them, set your
package's [SDK constraint][language version] lower bound to 3.7 or greater
(sdk: '^3.7.0').

Wildcard Variables

Local variables and parameters named _ are now non-binding and they can
be declared multiple times without collisions. You will no longer be able to use
these variables nor access their values. All wildcard variable declaration types
that have this behavior are described in the
wildcard variables specification.

Top-level variables, top-level function names, type names, member names, etc.
are unchanged. They can be named _ and used as they are today.

These are a few examples of where wildcard variables can be used:

Foo(_, this._, super._, void _()) {}

main() {
  var _ = 1;
  int _ = 2;

  list.where((_) => true);
}
Other Language Changes
  • Breaking Change #​56893: If a field is promoted to the type Null
    using is or as, this type promotion is now properly accounted for in
    reachability analysis. This makes the type system more self-consistent,
    because it mirrors the behavior of promoted local variables. This change is
    not expected to make any difference in practice.
Tools
Analyzer
  • Add a new 'Go to imports' command to find the import directives that export a
    declaration.
  • Assists and quick fixes that add an import now consider the
    prefer_relative_imports and always_use_package_imports lint rules.
  • Add a new fix that converts a ~/ operation into /, when the ~/
    operation is not available.
  • Add a fix that wraps an expression in await if the expression is currently
    not assignable, but awaiting it would make it assignable.
  • Assists and quick fixes that convert a forEach call into a for-loop now
    consider the prefer_final_in_for_each and always_specify_types lint
    rules.
  • Add an additional fix to correct a cascade_invocations lint rule violation.
  • Offer additional assists to wrap a Flutter widget with an Expanded widget,
    and with a Flexible widget.
  • Offer an assist to "inline" an else-block's inner if-statement with the
    else-block to read else if.
  • Add a fix to use_decorated_box by swapping the Container with
    ColoredBox as suggested by the lint.
  • Add an additional fix to import an unknown prefixed identifier by updating
    the show combinator on an existing import.
  • Add a fix to import an unknown prefixed identifier by adding an
    import directive with the given prefix.
  • Add a fix to import an unknown prefixed identifier by removing a hide
    combinator.
  • Add a fix to import an unknown identifier by adding an import directive with a
    show combinator, and optionally a prefix.
  • Code completion now suggests instance variables when completing inside the
    initializer of a late field.
  • Assists and quick fixes that add a const keyword now consider the
    prefer_const_declarations lint rule, preferring to add const to a variable
    declaration rather than the initial value.
  • Add a fix to add a missing on keyword in an extension declaration.
  • Add a fix to wrap an ambiguous property access or method call in an extension
    override.
    (Thanks @​FMorschel for the above enhancements!
  • The 'sort members' command now considers the sort_constructors_first lint
    rule.
  • The 'extract method' refactoring now uses generic method syntax for
    function-typed parameters.
  • Add quick fixes for more than 30 diagnostics.
  • Add the [strict_top_level_inference][strict_top_level_inference] lint rule.
  • Add the [unnecessary_underscores][unnecessary_underscores] lint rule.
  • Add the experimental [specify_nonobvious_property_types][specify_nonobvious_property_types] lint rule.
  • Add the experimental [omit_obvious_property_types][omit_obvious_property_types] lint rule.
  • Add the experimental [unnecessary_async][unnecessary_async] lint rule.
  • Add the experimental [unsafe_variance][unsafe_variance] lint rule.
  • Remove the [package_api_docs][package_api_docs] lint rule.
  • Remove the [unsafe_html][unsafe_html] lint rule.
Dart format

The formatter implements a new style better suited for the kind of
declarative code that many Dart users are writing today. The new style looks
similar to the style you get when you add trailing commas to argument lists,
except that now the formatter will add and remove those commas for you.

The dart format command uses the language version of
each input file to determine which style it gets. If the language version is 3.6
or lower, the code is formatted with the old style. If 3.7 or later, it gets the
new tall style.

You typically control the language version by setting a min SDK constraint in
your package's pubspec
. This means that when you update the SDK
constraint in your pubspec to move to 3.7, you are also opting in to the new
style.

In order to correctly determine the language version of each file it formats,
dart format (like other dart commands) looks for a package_config.json
file surrounding the files being formatted. This means that you need to run
dart pub get before formatting code in your package.
If you have format
checks in your continuous integration server, you'll want to make sure it runs
dart pub get too.

We don't intend to support both styles indefinitely. At some point in the
future when most of the ecosystem is on 3.7 or later, support for the old style
will be removed.

In addition to the new formatting style, a number of other changes are included,
some of them breaking:

  • Project-wide page width configuration. By long request, you can now
    configure your preferred formatting page width on a project-wide basis. When
    formatting a file, the formatter will look in the file's directory and any
    surrounding directories for an analysis_options.yaml file. If it finds one,
    it looks for YAML like so:

    formatter:
      page_width: 123

    If it finds a page width matching that schema, then the file is formatted
    using that width. Since the formatter will walk the surrounding directories
    until it finds an analysis_options.yaml file, this can be used to globally
    set the page width for an entire directory, package, or even collection of
    packages. Since analysis_options.yaml files already support an include
    key to reference other analysis_options.yaml files, you can define a single
    configuration and share it across a number of packages.

  • Opting out a region of code from formatting. In code formatted using the
    new style, you can use a pair of special marker comments to opt a region of
    code out of automated formatting:

    main() {
      this.isFormatted();
      // dart format off
      no   +   formatting
        +
          here;
      // dart format on
      formatting.isBackOnHere();
    }

    The comments must be exactly // dart format off and // dart format on.
    A file may have multiple regions, but they can't overlap or nest.

    This can be useful for highly structured data where custom layout helps the
    reader understand the data, like large lists of numbers.

  • Overriding the page width for a single file. In code formatted
    using the new tall style, you can use a special marker comment to control the
    page width that it's formatted using:

    // dart format width=30
    main() {
      someExpression +
          thatSplitsAt30;
    }

    This comment must appear before any code in the file and must match that
    format exactly. The width set by the comment overrides the width set by any
    surrounding analysis_options.yaml file.

    This feature is mainly for code generators that generate and immediately
    format code but don't know about any surrounding analysis_options.yaml
    that might be configuring the page width. By inserting this comment in the
    generated code before formatting, it ensures that the code generator's
    behavior matches the behavior of dart format.

    End users should mostly use analysis_options.yaml for configuring their
    preferred page width (or do nothing and continue to use the default page width
    of 80).

  • Breaking change: Remove support for dart format --fix. Instead, use
    dart fix. It supports all of the fixes that dart format --fix could apply
    and many more.

  • Treat the --stdin-name name as a path when inferring language version.
    When reading input on stdin, the formatter still needs to know its language
    version to know what style to apply. If the --stdin-name option is set, then
    that is treated as a file path and the formatter looks for a package config
    surrounding that file path to infer the language version from.

    If you don't want that behavior, pass in an explicit language version using
    --language-version=, or use --language-version=latest to parse the input
    using the latest language version supported by the formatter.

    If --stdin-name and --language-version are both omitted, then the
    formatter parses stdin using the latest supported language version.

  • Rename the --line-length option to --page-width. This is consistent
    with the public API, internal implementation, and docs, which all use "page
    width" to refer to the limit that the formatter tries to fit code into.

    The --line-length name is still supported for backwards compatibility, but
    may be removed at some point in the future. You're encouraged to move to
    --page-width. Use of this option (however it's named) is rare, and will
    likely be even rarer now that project-wide configuration is supported, so
    this shouldn't affect many users.

Dart to Javascript Compiler (dart2js)

The dart2js compiler which is invoked when the command 'dart compile js' is
used has been switched to use an AOT snapshot instead of a JIT snapshot.

Dart Development Compiler (dartdevc)

The dartdevc compiler and kernel_worker utility have been switched to use an
AOT snapshot instead of a JIT snapshot, the SDK build still includes a JIT
snapshot of these tools as package build/build_web_compiler depends on it. The
AOT snapshot can be used as follows to run DDC /bin/dartaotruntime /bin/snapshots/dartdevc_aot.dart.snapshot

Libraries
dart:html
  • dart:html is marked deprecated and will be removed in an upcoming release.
    Users should migrate to using dart:js_interop and package:web. See
    #​59716.
dart:indexed_db
  • dart:indexed_db is marked deprecated and will be removed in an upcoming
    release. Users should migrate to using dart:js_interop and package:web.
    See #​59716.
dart:io
  • HttpException will be thrown by HttpClient and HttpServer if a NUL
    (0x00) appears in a received HTTP header value.
dart:svg
  • dart:svg is marked deprecated and will be removed in an upcoming release.
    Users should migrate to using dart:js_interop and package:web. See
    #​59716.
dart:web_audio
  • dart:web_audio is marked deprecated and will be removed in an upcoming
    release. Users should migrate to using dart:js_interop and package:web.
    See #​59716.
dart:web_gl
  • dart:web_gl is marked deprecated and will be removed in an upcoming release.
    Users should migrate to using dart:js_interop and package:web. See
    #​59716.
dart:js
  • dart:js is marked deprecated and will be removed in an upcoming release.
    Users should migrate to using dart:js_interop. See #​59716.
dart:js_util
  • dart:js_util is marked deprecated and will be removed in an upcoming
    release. Users should migrate to using dart:js_interop. See #​59716.

v3.6.2

Compare Source

Released on: 2025-01-30

  • Fixes a bug where HttpServer responses were not correctly encoded
    if a "Content-Type" header was set (issue #​59719).
  • Fix dart format to parse code at language version 3.6 so that digit
    separators can be parsed correctly (issue #​59815, dart_style issue
    #​1630).
  • Fixes an issue where the DevTools analytics did not distinguish
    between new and legacy inspector events (issue #​59884).
  • When running dart fix on a folder that contains a library with multiple
    files and more than one needs a fix, the fix will now be applied correctly
    only once to each file (issue #​59572).

v3.6.1

Compare Source

Released on: 2025-01-08

  • When inside a pub workspace, pub get will now delete stray
    .dart_tool/package_config.json files in directories between the
    workspace root and workspace directories. Preventing confusing behavior
    when migrating a repository to pub workspaces (issue pub#4445).
  • Fixes crash during AOT and dart2wasm compilation which was caused by
    the incorrect generic covariant field in a constant object (issue
    #​57084).
  • Fixes analysis options discovery in the presence of workspaces
    (issue #​56552).

v3.6.0

Compare Source

Released on: 2024-12-11

Language

Dart 3.6 adds digit separators to the language. To use them, set your
package's [SDK constraint][language version] lower bound to 3.6 or greater
(sdk: '^3.6.0').

Digit separators

Digits in number literals (decimal integer literals, double literals,
scientific notation literals, and hexadecimal literals) can now include
underscores between digits, as "digit separators." The separators do not change
the value of a literal, but can serve to make the number more readable.

100__000_000__000_000__000_000  // one hundred million million millions!
0x4000_0000_0000_0000
0.000_000_000_01
0x00_14_22_01_23_45  // MAC address

Separators are not allowed at the start of a number (this would be parsed as an
identifier), at the end of a number, or adjacent to another character in a
number, like ., x, or the e in scientific notation.

  • Breaking Change #​56065: The context used by the compiler and analyzer
    to perform type inference on the operand of a throw expression has been
    changed from the "unknown type" to Object. This makes the type system more
    self-consistent, because it reflects the fact that it's not legal to throw
    null. This change is not expected to make any difference in practice.
Libraries
dart:io
  • Breaking Change #​52444: Removed the Platform() constructor, which
    has been deprecated since Dart 3.1.

  • Breaking Change #​53618: HttpClient now responds to a redirect
    that is missing a "Location" header by throwing RedirectException, instead
    of StateError.

dart:js_interop
  • Added constructors for JSArrayBuffer, JSDataView, and concrete typed array
    types e.g. JSInt8Array.
  • Added length and []/[]= operators to JSArray.
  • Added toJSCaptureThis so this is passed in from JavaScript to the
    callback as the first parameter.
  • Added a static from method on JSArray to create a JSArray from a given
    JavaScript iterable or array-like object.
Tools
CFE
  • Breaking Change #​56466: The implementation of the UP and
    DOWN algorithms in the CFE are changed to match the specification
    and the corresponding implementations in the Analyzer. The upper and
    lower closures of type schemas are now computed just before they are
    passed into the subtype testing procedure instead of at the very
    beginning of the UP and DOWN algorithms.
Dart format
  • Preserve type parameters on old-style function-typed formals that also use
    this. or super..
  • Correctly format imports with both as and if clauses.
Wasm compiler (dart2wasm)
  • The condition dart.library.js is now false on conditional imports in
    dart2wasm. Note that it was already a static error to import dart:js
    directly (see #​55266).
Pub
  • Support for workspaces. This allows you to develop and resolve multiple
    packages from the same repo together. See https://dart.dev/go/pub-workspaces
    for more info.

  • New command dart pub bump. Increments the version number of the current
    package.

    For example: dart pub bump minor will change the version from 1.2.3 to
    1.3.0.

  • New validation: dart pub publish will warn if your git status is not
    clean.

  • New flag dart pub upgrade --unlock-transitive.

  • dart pub upgrade --unlock-transitive pkg, will unlock and upgrade all the
    dependencies of pkg instead of just pkg.

Analyzer
  • Add the [use_truncating_division][use_truncating_division] lint rule.
  • Add the experimental [omit_obvious_local_variable_types][omit_obvious_local_variable_types] lint rule.
  • Add the experimental [specify_nonobvious_local_variable_types][specify_nonobvious_local_variable_types] lint rule.
  • Add the experimental [avoid_futureor_void][avoid_futureor_void] lint rule.
  • Add quick fixes for more than 14 diagnostics.
  • Add new assists: "add digit separators", "remove digit separators", and
    "invert conditional expression".

v3.5.4

Compare Source

v3.5.3

Compare Source

  • Fixes an issue with the DevTools Memory tool causing OOMs. and an
    issue resulting in a missing tab bar when DevTools is embedded in
    IntelliJ and Android Studio (issue#​56607).
  • Fixes an issue with the DevTools release notes showing each time
    DevTools is opened instead of only the first time (issue#​56607).
  • Fixes an issue resulting in a missing tab bar when DevTools is
    embedded in IntelliJ and Android Studio (issue#​56607).

v3.5.2

Compare Source

  • Fixes a bug where ZLibDecoder would incorrectly attempt to decompress data
    past the end of the zlib footer (issue #​56481).
  • Fixes issue where running dart from PATH could result in some commands not
    working as expected (issues #​56080, #​56306, #​56499).
  • Fixes analysis server plugins not receiving setContextRoots requests or
    being provided incorrect context roots in multi-package workspaces (issue
    #​56475).

v3.5.1

Compare Source

  • Fixes resolving include: in analysis_options.yaml file in a nested
    folder in the workspace (issue#​56464).
  • Fixes source maps generated by dart compile wasm when optimizations are
    enabled (issue #​56423).
  • Fixes a bug in the dart2wasm compiler in unsound -O3 / -O4 modes where a
    implicit setter for a field of generic type will store null instead of the
    field value (issue #​56374).
  • Fixes a bug in the dart2wasm compiler that can trigger in certain situations
    when using partial instantiations of generic tear-offs (constructors or static
    methods) in constant expressions (issue #​56440).
  • The algorithm for computing the standard upper bound of two types,
    also known is UP, is provided the missing implementation for
    StructuralParameterType objects. In some corner cases cases the
    lacking implementation resulted in a crash of the compiler (issue #​56457).

v3.5.0

Compare Source

Language
  • Breaking Change #​55418: The context used by the compiler to perform
    type inference on the operand of an await expression 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: DateTime on 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 a DateTime value without rounding the lower
    digits. This change might be breaking for apps that rely in some way on the
    .microsecond component always being zero, for example, expecting only three
    fractional second digits in the toString() representation. Small
    discrepancies in arithmetic due to rounding of web integers may still occur
    for extreme values, (1) microsecondsSinceEpoch outside the safe range,
    corresponding to dates with a year outside of 1685..2255, and (2) arithmetic
    (add, subtract, difference) where the Duration argument or result
    exceeds 570 years.
dart:io
  • Breaking Change #​55786: SecurityContext is now final. This means
    that SecurityContext can no longer be subclassed. SecurityContext
    subclasses were never able to interoperate with other parts of dart:io.

  • A ConnectionTask can now be created using an existing Future<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 TypedDataList to typed data lists, implementing both
    List and TypedData. Allows abstracting over all such lists without losing
    access to either the List or the TypedData members.
    A ByteData is still only a TypedData, not a list.

dart:js_interop
  • Breaking Change #​55508: importModule now accepts a JSAny instead
    of a String to support other JS values as well, like TrustedScriptURLs.

  • Breaking Change #​55267: isTruthy and not now return JSBoolean
    instead of bool to be consistent with the other operators.

  • Breaking Change ExternalDartReference no longer implements Object.
    ExternalDartReference now accepts a type parameter T with a bound of
    Object? to capture the type of the Dart object that is externalized.
    ExternalDartReferenceToObject.toDartObject now returns a T.
    ExternalDartReferenceToObject and ObjectToExternalDartReference are now
    extensions on T and ExternalDartReference<T>, respectively, where T extends Object?. See #​55342 and #​55536 for more details.

  • Fixed some consistency issues with Function.toJS across all compilers.
    Specifically, calling Function.toJS on 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
Analyzer
  • Add the [unintended_html_in_doc_comment][unintended_html_in_doc_comment] lint rule.
  • Add the [invalid_runtime_check_with_js_interop_types][invalid_runtime_check_with_js_interop_types] lint rule.
  • Add the [document_ignores][document_ignores] lint rule.
  • Add quick fixes for more than 70 diagnostics.
  • The "Add missing switch cases" quick fix now adds multiple cases, such that
    the switch becomes exhaustive.
  • The "Remove const" quick fix now adds const keywords to child nodes, where
    appropriate.
Pub
  • New flag dart pub downgrade --tighten to 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-safety has been removed.

  • Dart_NewListOf and Dart_IsLegacyType functions are
    removed from Dart C API.

  • Dart_DefaultCanonicalizeUrl is removed from the Dart C API.

v3.4.4

Compare Source

This is a patch release that:

  • Fixes an issue where pub would crash when failing to fetch advisories from
    the server. (issue pub#4269).

  • Fixes an issue where const bool.fromEnvironment('dart.library.ffi') is true
    and conditional import condition dart.library.ffi is true in dart2wasm.
    (issue #​55948).

  • Fixes an issue where FFI calls with variadic arguments on MacOS Arm64
    would mangle the arguments. (issue #​55943).

v3.4.3

Compare Source

This is a patch release that:

  • Fixes an issue where DART_VM_OPTIONS were not correctly parsed for
    standalone Dart executables created with dart compile exe (issue
    #​55818).

  • Fixes a bug in dart2wasm that can result in a runtime error that says
    array.new_fixed() has a constant larger than 10000 (issue #​55873).

  • Adds support for --enable-experiment flag to dart compile wasm
    (issue #​55894).

  • Fixes an issue in dart2wasm compiler that can result in incorrect
    nullability of type parameter (see #​55895).

  • Disallows dart:ffi imports in user code in dart2wasm (e.g. issue
    [#​53910]) as dart2wasm's currently only supports a small subset of
    dart:ffi (issue #​55890).

v3.4.2

Compare Source

This is a patch release that:

  • Marks dart compile wasm as no longer experimental.

  • Fixes two bugs in exception handling in async functions in dart2wasm
    (issues #​55347, #​55457).

  • Fixes restoration of this variable in sync* and async functions in
    dart2wasm.

  • Implements missing control flow constructs (exceptions, switch/case with
    yields) in sync* in dart2wasm (issues #​51342, #​51343).

  • Fixes a bug dart2wasm compiler that surfaces as a compiler crash when indexing
    lists where the compiler proofs the list to be constant and the index is
    out-of-bounds (issue #​55817).

v3.4.1

Compare Source

This is a patch release that:

  • Fixes a bug in the CFE which could manifest as compilation errors of Flutter
    web apps when compiled with dart2wasm (issue #​55714).

  • Fixes a bug in the pub client, such that dart run will not interfere with
    Flutter l10n (at least for most cases) (issue #​55758).

v3.4.0

Compare Source

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 ParallelWaitError to get some meta-information that
    it can expose in its toString, and the Iterable<Future>.wait and
    (Future,...,Future).wait extension methods now provide that information.
    Should make a ParallelWaitError easier to log.
dart:cli
  • Breaking change [#​52121][]: waitFor is removed in 3.4.
dart:ffi
  • Added Struct.create and Union.create to create struct and union views
    of the sequence of bytes stored in a subtype of TypedData.
dart:io
  • Breaking change #​53863: Stdout has a new field lineTerminator,
    which allows developers to control the line ending used by stdout and
    stderr. Classes that implement Stdout must define the lineTerminator
    field. The default semantics of stdout and stderr are not changed.

  • Deprecates FileSystemDeleteEvent.isDirectory, which always returns
    false.

dart:js_interop
  • Fixes an issue with several comparison operators in JSAnyOperatorExtension
    that were declared to return JSBoolean but really returned bool. This led
    to runtime errors when trying to use the return values. The implementation now
    returns a JSBoolean to align with the interface. See issue #​55024 for
    more details.

  • Added ExternalDartReference and related conversion functions
    toExternalReference and toDartObject. This is a faster alternative to
    JSBoxedDartObject, but with fewer safety guarantees and fewer
    interoperability capabilities. See #​55187 for more details.

  • On dart2wasm, JSBoxedDartObject now 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 isA helper 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-correctness in 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 all dart.library.foo strings, where dart:foo is not an
    available library. Instead there will only be entries for the available
    libraries, like dart.library.core, where the value was, and still is,
    "true". This should have no effect on const bool.fromEnvironment(...) or
    const String.fromEnvironment(...) without a defaultValue argument, an
    argument which was always ignored previously. It changes the behavior of
    const bool.hasEnvironment(...) on such an input, away from always being
    true and 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 outdated will now surface if a dependency
    is affected by a security advisory, unless the advisory is listed under a
    ignored_advisories section in the pubspec.yaml file. To learn more about
    pub's support for security advisories, visit
    dart.dev/go/pub-security-advisories.

  • path-dependencies inside git-dependencies are now resolved relative to the
    git repo.

  • All dart pub commands can now be run from any subdirectory of a project. Pub
    will find the first parent directory with a pubspec.yaml and operate
    relative it.

  • New command dart pub unpack that 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 exe via the DART_VM_OPTIONS environment variable.
    DART_VM_OPTIONS should 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_OPTIONS environment variable:

    DART_VM_OPTIONS=--random_seed=42,--verbose_gc
  • Dart VM no longer supports external strings: Dart_IsExternalString,
    Dart_NewExternalLatin1String and Dart_NewExternalUTF16String functions are
    removed from Dart C API.

v3.3.4

Compare Source

This is a patch release that:

  • Fixes an issue with JS interop in dart2wasm where JS interop methods that used
    the enclosing library's @JS annotation were actually using the invocation's
    enclosing library's @JS annotation. (issue #​55430).

v3.3.3

Compare Source

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

Compare Source

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.timeZoneName
    on 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

Compare Source

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 @JS annotation on the
    library (issue #​55057).
  • Disallows certain types involving extension types from being used as the
    operand of an await expression, unless the extension type itself implements
    Future (issue #​55095).

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:

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
    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:

    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 x can be changed to int? 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 allow start and end to be after the end of
    the Iterable argument, just like skip and take does on an Iterable.
dart:ffi
  • In addition to functions, @Native can now be used on fields.
  • Allow taking the address of native functions and fields via
    Native.addressOf.
  • The elementAt pointer arithmetic extension methods on
    core Pointer types are now deprecated.
    Migrate to the new - and + operators instead.
  • The experimental and deprecated @FfiNative annotation has been removed.
    Usages should be updated to use the @Native annotation.
dart:js_interop
  • Breaking Change in the representation of JS types #​52687: JS types
    like JSAny were previously represented using a custom erasure of
    @staticInterop types that were compiler-specific. They are now represented
    as extension types where their representation types are compiler-specific.
    This means that user-defined @staticInterop types that implemented JSAny
    or JSObject can no longer do so and need to use
    JSObject.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: JSArray and JSPromise are now generic
    types whose type parameter is a subtype of JSAny?. 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_interop extension
    members are moved to different extensions on the same type or a supertype to
    better organize the API surface. See JSAnyUtilityExtension and
    JSAnyOperatorExtension for the new extensions. This shouldn't make a
    difference unless the extension names were explicitly used.
  • Add importModule to allow users to dynamically import modules using the JS
    import() expression.
dart:js_interop_unsafe
  • Add has helper to make hasProperty 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.

    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 base so
    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 create command now uses v3 of package: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.
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, and dart:js
    are now disallowed from being imported when compiling with dart2wasm. Prefer
    using dart:js_interop and dart:js_interop_unsafe.
Development JavaScript compiler (DDC)
  • Type arguments of package:js interop types are now printed as any instead
    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 Invocation that is passed to noSuchMethod will no longer have a
    minified memberName, even when dart2js is invoked with --minify.
    See #​54201 for more details.
Analyzer
  • You can now suppress diagnostics in pubspec.yaml files by
    adding an # ignore: <diagnostic_id> comment.
  • Invalid dart doc comment directives are now reported.
  • The [flutter_style_todos][flutter_style_todos] lint now has a quick fix.
Linter
  • Removed the iterable_contains_unrelated_type and

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

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.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate
Copy link
Contributor Author

renovate bot commented Aug 22, 2023

⚠ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: apps/pubspec.lock
Command failed: docker run --rm --name=renovate_a_sidecar --label=renovate_a_child --memory=3584m -v "/tmp/worker/18e999/9e84b9/repos/github/hackariens/flutter":"/tmp/worker/18e999/9e84b9/repos/github/hackariens/flutter" -v "/tmp/worker/18e999/9e84b9/cache":"/tmp/worker/18e999/9e84b9/cache" -e CONTAINERBASE_CACHE_DIR -w "/tmp/worker/18e999/9e84b9/repos/github/hackariens/flutter/apps" ghcr.io/containerbase/sidecar:9.13.1 bash -l -c "install-tool flutter 3.13.0 && flutter pub get --no-precompile"
Downloading Linux x64 Dart SDK from Flutter engine 1ac611c64eadbd93c5f5aba5494b8fc3b35ee952...
Building flutter tool...
pubspec.yaml has no lower-bound SDK constraint.
You should edit pubspec.yaml to contain an SDK constraint:

environment:
  sdk: '^3.1.0'

See https://dart.dev/go/sdk-constraint

@renovate renovate bot force-pushed the renovate/dart-3.x branch from 8d8c26d to 159192c Compare December 12, 2024 13:25
Copy link
Contributor Author

renovate bot commented Dec 12, 2024

⚠️ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: apps/pubspec.lock
Command failed: flutter pub get --no-precompile
pubspec.yaml has no lower-bound SDK constraint.
You should edit pubspec.yaml to contain an SDK constraint:

environment:
  sdk: '^3.6.0'

See https://dart.dev/go/sdk-constraint
Failed to update packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants