Skip to content

Conversation

@ksokolovskyi
Copy link
Contributor

@ksokolovskyi ksokolovskyi commented Jul 9, 2025

Closes #143396

Description

  • Removes js_util library usage across the codebase

In order to get rid of dart.library.js_util in kIsWeb constant the dart analyzer has to be updated first. For now, the dart.library.js_util value is hardcoded in the source code: https://github.com/dart-lang/sdk/blob/1a88edceb75f70490827ef845586bf549d5f05b0/pkg/analyzer/lib/src/dart/constant/evaluation.dart#L2908-L2915. So we either have to update this value or wait for the dart-lang/sdk#50045 fix.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. engine flutter/engine related. See also e: labels. platform-web Web applications specifically labels Jul 9, 2025
@ksokolovskyi ksokolovskyi requested review from ditman, harryterkelsen and mdebbar and removed request for harryterkelsen and mdebbar July 9, 2025 13:36
Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for helping out with this cleanup!

I'm curious why you reverted the kIsWeb change?

@ksokolovskyi
Copy link
Contributor Author

Thanks for helping out with this cleanup!

I'm curious why you reverted the kIsWeb change?

Hi @mdebbar! First of all, thanks for the review!

This is an interesting moment. While changing the kIsWeb value from dart.library.js_util to dart.library.js_interop works well, the analyzer starts to complain in some widgets.

image

Basically, for the analyzer, this value is false and the value in the ternary operator is equal to the default value in the constructor, which triggers avoid_redundant_argument_values lint.
We could add an inline analyzer ignore with comments, but I think that it would be better to either update this value in the analyzer source or wait for the dart-lang/sdk#50045 fix.

@mdebbar
Copy link
Contributor

mdebbar commented Jul 10, 2025

@srujzs any idea why this works:

const bool kIsWeb = bool.fromEnvironment('dart.library.js_util');

but this doesn't:

const bool kIsWeb = bool.fromEnvironment('dart.library.js_interop');

@ksokolovskyi
Copy link
Contributor Author

ksokolovskyi commented Jul 10, 2025

@mdebbar I've added some interop members as you requested.

Regarding your last question, actually kIsWeb with 'dart.library.js_interop' value works as expected and is true when running on web. The issue is that the analyzer treats the kIsWeb value as false, so the Dart team added a special case handling for dart.library.js_interop here: https://github.com/dart-lang/sdk/blob/83d862217e5960cc1e8055312f950d29d7803f7e/pkg/analyzer/lib/src/dart/constant/evaluation.dart#L2909

@mdebbar
Copy link
Contributor

mdebbar commented Jul 10, 2025

@ksokolovskyi Ah I see now. You explained it in your previous comment too but I didn't catch it :P

@mkustermann @srujzs @scheglov could someone help us with the analyzer issue so we can fully migrate off of dart:js_util?

@srujzs
Copy link
Contributor

srujzs commented Jul 10, 2025

It seems like the ideal fix is waiting for dart-lang/sdk#50045 to be resolved, but it doesn't look like that's an easy/simple fix so we should have a special case for js_interop as well like we did with js_util. @scheglov, any objections?

@srujzs
Copy link
Contributor

srujzs commented Jul 10, 2025

https://dart-review.googlesource.com/c/sdk/+/439820 has landed to workaround this issue for dart:js_interop.

@ksokolovskyi
Copy link
Contributor Author

@srujzs thanks a lot for your workaround!
I will wait for the roller to pick it up and then update kIsWeb.

Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @srujzs for the quick help!

Everything looks good to me. Once the analyzer change rolls into Flutter and kIsWeb is updated, we can go ahead and land this PR.

Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple minor suggestions that I missed previously. Other than that, looks good to me once we address the kIsWeb situation.

@srujzs
Copy link
Contributor

srujzs commented Jul 14, 2025

@srujzs Can this workaround be back ported to 7.x.x? If it's too much work or not possible to back port, then I'm okay with the lint ignores and a TODO.

This may be more complicated than I imagine but not sure. I suppose one can checkout the latest 7.x.x release, cherry-pick my change, and then release a new minor version and pub should be happy? It'd mess up the version history of main though. @scheglov, thoughts?

@scheglov
Copy link
Contributor

The change is very small, so https://dart-review.googlesource.com/c/sdk/+/440263

@scheglov
Copy link
Contributor

Published analyzer 7.5.8

@ksokolovskyi
Copy link
Contributor Author

@scheglov, thanks a lot!

@srujzs @mdebbar I've locally updated the pubspec.yaml files in root and in flutter_tools like the following:

...
_fe_analyzer_shared: 85.0.0
analyzer: 7.5.9
...

But I still have analyzer issues in the IDE or when running flutter-dev analyze.
Do you have any thoughts about what I am missing?

@mdebbar
Copy link
Contributor

mdebbar commented Jul 15, 2025

But I still have analyzer issues in the IDE or when running flutter-dev analyze.
Do you have any thoughts about what I am missing?

This may be obvious, but did you also do flutter pub get?

@ksokolovskyi
Copy link
Contributor Author

ksokolovskyi commented Jul 15, 2025

This may be obvious, but did you also do flutter pub get?

Yep. I am wondering how Linux analyze passed even without updating the analyzer dependency version 🤔

UPD: I removed bin/cache and downloaded all artifacts again. After that analyzer stopped yielding on kIsWeb usages as before. But I still don't know how this worked if analyzer is pinned to v7.4.5 in root pubspec.yaml.

@ksokolovskyi ksokolovskyi requested a review from srujzs July 15, 2025 17:36
Copy link
Contributor

@srujzs srujzs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small nits. LGTM!

@ksokolovskyi
Copy link
Contributor Author

@srujzs thanks for your comments. Could you please take a quick look at the last commit and confirm that it is what you expected?

Copy link
Contributor

@srujzs srujzs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for addressing the nits!

@ksokolovskyi ksokolovskyi added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 16, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Jul 16, 2025
Merged via the queue into flutter:master with commit 66281ce Jul 16, 2025
177 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 17, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jul 17, 2025
flutter/flutter@c2739f0...9c626d9

2025-07-17 [email protected] Roll Skia from 5b4afa58289a to 3673a1f26a63 (1 revision) (flutter/flutter#172274)
2025-07-17 [email protected] Roll Fuchsia Linux SDK from JRFUXSNXExcfjVYvA... to HXdm7P0a4ZJVm_TE-... (flutter/flutter#172268)
2025-07-17 [email protected] Roll Dart SDK from d71df90177e4 to 486f9c0663bc (1 revision) (flutter/flutter#172269)
2025-07-17 [email protected] Roll Skia from 3ad1aace3e02 to 5b4afa58289a (3 revisions) (flutter/flutter#172264)
2025-07-17 [email protected] Perform OpenGL compositing in the Flutter thread and write to a framebuffer. (flutter/flutter#172090)
2025-07-17 [email protected] Licenses cpp 716 (flutter/flutter#172261)
2025-07-16 [email protected] Remove emoji from ci.yaml, because we still live with CP1252 for some silly reason (flutter/flutter#172256)
2025-07-16 [email protected] Roll Skia from bf3f9b77d3a8 to 3ad1aace3e02 (11 revisions) (flutter/flutter#172255)
2025-07-16 [email protected] Sync `CHANGELOG.md` (3.32.7) to `master` branch (flutter/flutter#172253)
2025-07-16 [email protected] Properly lay out and position RenderWebImage (flutter/flutter#171916)
2025-07-16 [email protected] Remove dead link in the doc index. (flutter/flutter#172240)
2025-07-16 [email protected] Roll Dart SDK from 766ee8029b11 to d71df90177e4 (1 revision) (flutter/flutter#172243)
2025-07-16 [email protected] Fix use of `Join-Path` in `last_engine_commit.ps1`(poweshell) (flutter/flutter#172242)
2025-07-16 [email protected] Marks Linux_pixel_7pro integration_ui_driver to be unflaky (flutter/flutter#172213)
2025-07-16 [email protected] [skwasm] Decrease reliance on finalizers/GC (flutter/flutter#172187)
2025-07-16 [email protected] Use `release-*.version` to simplify `last_engine_commit.sh` (no branch operations) (flutter/flutter#172236)
2025-07-16 [email protected] Roll Skia from 59be8479c637 to bf3f9b77d3a8 (7 revisions) (flutter/flutter#172233)
2025-07-16 [email protected] [web] Remove all usages of js_util. (flutter/flutter#171871)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
azatech pushed a commit to azatech/flutter that referenced this pull request Jul 28, 2025
Closes flutter#143396

### Description
- Removes `js_util` library usage across the codebase

In order to get rid of `dart.library.js_util` in
[`kIsWeb`](https://github.com/flutter/flutter/blob/e8d56b25c039666e1040c22ac36cfa3550be58cf/packages/flutter/lib/src/foundation/constants.dart#L83)
constant the dart analyzer has to be updated first. For now, the
`dart.library.js_util` value is hardcoded in the source code:
https://github.com/dart-lang/sdk/blob/1a88edceb75f70490827ef845586bf549d5f05b0/pkg/analyzer/lib/src/dart/constant/evaluation.dart#L2908-L2915.
So we either have to update this value or wait for the
dart-lang/sdk#50045 fix.

## Pre-launch Checklist

- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [X] I signed the [CLA].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [X] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [X] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
vashworth pushed a commit to vashworth/packages that referenced this pull request Jul 30, 2025
…r#9641)

flutter/flutter@c2739f0...9c626d9

2025-07-17 [email protected] Roll Skia from 5b4afa58289a to 3673a1f26a63 (1 revision) (flutter/flutter#172274)
2025-07-17 [email protected] Roll Fuchsia Linux SDK from JRFUXSNXExcfjVYvA... to HXdm7P0a4ZJVm_TE-... (flutter/flutter#172268)
2025-07-17 [email protected] Roll Dart SDK from d71df90177e4 to 486f9c0663bc (1 revision) (flutter/flutter#172269)
2025-07-17 [email protected] Roll Skia from 3ad1aace3e02 to 5b4afa58289a (3 revisions) (flutter/flutter#172264)
2025-07-17 [email protected] Perform OpenGL compositing in the Flutter thread and write to a framebuffer. (flutter/flutter#172090)
2025-07-17 [email protected] Licenses cpp 716 (flutter/flutter#172261)
2025-07-16 [email protected] Remove emoji from ci.yaml, because we still live with CP1252 for some silly reason (flutter/flutter#172256)
2025-07-16 [email protected] Roll Skia from bf3f9b77d3a8 to 3ad1aace3e02 (11 revisions) (flutter/flutter#172255)
2025-07-16 [email protected] Sync `CHANGELOG.md` (3.32.7) to `master` branch (flutter/flutter#172253)
2025-07-16 [email protected] Properly lay out and position RenderWebImage (flutter/flutter#171916)
2025-07-16 [email protected] Remove dead link in the doc index. (flutter/flutter#172240)
2025-07-16 [email protected] Roll Dart SDK from 766ee8029b11 to d71df90177e4 (1 revision) (flutter/flutter#172243)
2025-07-16 [email protected] Fix use of `Join-Path` in `last_engine_commit.ps1`(poweshell) (flutter/flutter#172242)
2025-07-16 [email protected] Marks Linux_pixel_7pro integration_ui_driver to be unflaky (flutter/flutter#172213)
2025-07-16 [email protected] [skwasm] Decrease reliance on finalizers/GC (flutter/flutter#172187)
2025-07-16 [email protected] Use `release-*.version` to simplify `last_engine_commit.sh` (no branch operations) (flutter/flutter#172236)
2025-07-16 [email protected] Roll Skia from 59be8479c637 to bf3f9b77d3a8 (7 revisions) (flutter/flutter#172233)
2025-07-16 [email protected] [web] Remove all usages of js_util. (flutter/flutter#171871)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
ksokolovskyi added a commit to ksokolovskyi/flutter that referenced this pull request Aug 19, 2025
Closes flutter#143396

### Description
- Removes `js_util` library usage across the codebase

In order to get rid of `dart.library.js_util` in
[`kIsWeb`](https://github.com/flutter/flutter/blob/e8d56b25c039666e1040c22ac36cfa3550be58cf/packages/flutter/lib/src/foundation/constants.dart#L83)
constant the dart analyzer has to be updated first. For now, the
`dart.library.js_util` value is hardcoded in the source code:
https://github.com/dart-lang/sdk/blob/1a88edceb75f70490827ef845586bf549d5f05b0/pkg/analyzer/lib/src/dart/constant/evaluation.dart#L2908-L2915.
So we either have to update this value or wait for the
dart-lang/sdk#50045 fix.

## Pre-launch Checklist

- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [X] I signed the [CLA].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [X] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [X] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
mboetger pushed a commit to mboetger/flutter that referenced this pull request Sep 18, 2025
Closes flutter#143396

### Description
- Removes `js_util` library usage across the codebase

In order to get rid of `dart.library.js_util` in
[`kIsWeb`](https://github.com/flutter/flutter/blob/e8d56b25c039666e1040c22ac36cfa3550be58cf/packages/flutter/lib/src/foundation/constants.dart#L83)
constant the dart analyzer has to be updated first. For now, the
`dart.library.js_util` value is hardcoded in the source code:
https://github.com/dart-lang/sdk/blob/1a88edceb75f70490827ef845586bf549d5f05b0/pkg/analyzer/lib/src/dart/constant/evaluation.dart#L2908-L2915.
So we either have to update this value or wait for the
dart-lang/sdk#50045 fix.

## Pre-launch Checklist

- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [X] I signed the [CLA].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [X] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [X] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
Closes flutter#143396

### Description
- Removes `js_util` library usage across the codebase

In order to get rid of `dart.library.js_util` in
[`kIsWeb`](https://github.com/flutter/flutter/blob/e8d56b25c039666e1040c22ac36cfa3550be58cf/packages/flutter/lib/src/foundation/constants.dart#L83)
constant the dart analyzer has to be updated first. For now, the
`dart.library.js_util` value is hardcoded in the source code:
https://github.com/dart-lang/sdk/blob/1a88edceb75f70490827ef845586bf549d5f05b0/pkg/analyzer/lib/src/dart/constant/evaluation.dart#L2908-L2915.
So we either have to update this value or wait for the
dart-lang/sdk#50045 fix.

## Pre-launch Checklist

- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [X] I signed the [CLA].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [X] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [X] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems engine flutter/engine related. See also e: labels. framework flutter/packages/flutter repository. See also f: labels. platform-web Web applications specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid using js_util.promiseToFuture, instead prefer the extension on JSPromise<>

4 participants