Skip to content

Commit 6edbc19

Browse files
authored
Remove package:js/dart:js_interop conflicts (flutter#124879)
dart:js_interop and package:js will start conflicting, since they both have an `@JS` annotation. Until we're ready to only use dart:js_interop (which will require updating the SDK constraints of every package), we should hide the `@JS` annotation from dart:js_interop. Due to shadowing, this is the behavior today, so there should be no functional change. Unblocks https://dart-review.googlesource.com/c/sdk/+/294130/8 and prevents confusing shadowing of dart:js_interop annotations like we do today. - [Mentioned CL that is unblocked] I listed at least one issue that this PR fixes in the description above. - [Need test-exemption] I added new tests to check the change I am making, or this PR is [test-exempt]. - [Need to run] All existing and new tests are passing.
1 parent 81c3bc5 commit 6edbc19

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

packages/flutter/lib/src/foundation/_capabilities_web.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import 'dart:js_interop';
5+
// For now, we're hiding dart:js_interop's `@JS` to avoid a conflict with
6+
// package:js' `@JS`. In the future, we should be able to remove package:js
7+
// altogether and just import dart:js_interop.
8+
import 'dart:js_interop' hide JS;
69
import 'package:js/js.dart';
710

811
// This value is set by the engine. It is used to determine if the application is

packages/flutter/lib/src/services/dom.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import 'dart:js_interop';
5+
// For now, we're hiding dart:js_interop's `@JS` to avoid a conflict with
6+
// package:js' `@JS`. In the future, we should be able to remove package:js
7+
// altogether and just import dart:js_interop.
8+
import 'dart:js_interop' hide JS;
69
import 'package:js/js.dart';
710

811
/// This file includes static interop helpers for Flutter Web.

packages/flutter/test/painting/_test_http_request.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import 'dart:js_interop';
5+
// For now, we're hiding dart:js_interop's `@JS` to avoid a conflict with
6+
// package:js' `@JS`. In the future, we should be able to remove package:js
7+
// altogether and just import dart:js_interop.
8+
import 'dart:js_interop' hide JS;
69

710
import 'package:flutter/src/services/dom.dart';
811
import 'package:js/js.dart';

0 commit comments

Comments
 (0)