Skip to content
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

fix(sdk): update dependency dart to >=3.7.0 <4.0.0 #689

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

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Feb 12, 2025

This PR contains the following updates:

Package Update Change
dart (source) minor >=3.6.2 <4.0.0 -> >=3.7.0 <4.0.0

Release Notes

dart-lang/sdk (dart)

v3.7.0

Compare Source

Released on: Unreleased

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
  • 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 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.

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

@renovate renovate bot enabled auto-merge (squash) February 12, 2025 10:53
@renovate renovate bot force-pushed the renovate/dart-minor-patch-version branch 3 times, most recently from 41b7f5c to fd6d725 Compare February 14, 2025 15:43
@renovate renovate bot force-pushed the renovate/dart-minor-patch-version branch from fd6d725 to 3d990f7 Compare February 14, 2025 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant