From 6edbc19597f56ec245c85d7a44189c7589afef41 Mon Sep 17 00:00:00 2001 From: Srujan Gaddam <58529443+srujzs@users.noreply.github.com> Date: Tue, 18 Apr 2023 15:15:53 -0700 Subject: [PATCH] Remove package:js/dart:js_interop conflicts (#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. --- packages/flutter/lib/src/foundation/_capabilities_web.dart | 5 ++++- packages/flutter/lib/src/services/dom.dart | 5 ++++- packages/flutter/test/painting/_test_http_request.dart | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/flutter/lib/src/foundation/_capabilities_web.dart b/packages/flutter/lib/src/foundation/_capabilities_web.dart index 4da8d6223d..86deb78d0d 100644 --- a/packages/flutter/lib/src/foundation/_capabilities_web.dart +++ b/packages/flutter/lib/src/foundation/_capabilities_web.dart @@ -2,7 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:js_interop'; +// For now, we're hiding dart:js_interop's `@JS` to avoid a conflict with +// package:js' `@JS`. In the future, we should be able to remove package:js +// altogether and just import dart:js_interop. +import 'dart:js_interop' hide JS; import 'package:js/js.dart'; // This value is set by the engine. It is used to determine if the application is diff --git a/packages/flutter/lib/src/services/dom.dart b/packages/flutter/lib/src/services/dom.dart index 6dad28b3d5..c9181beede 100644 --- a/packages/flutter/lib/src/services/dom.dart +++ b/packages/flutter/lib/src/services/dom.dart @@ -2,7 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:js_interop'; +// For now, we're hiding dart:js_interop's `@JS` to avoid a conflict with +// package:js' `@JS`. In the future, we should be able to remove package:js +// altogether and just import dart:js_interop. +import 'dart:js_interop' hide JS; import 'package:js/js.dart'; /// This file includes static interop helpers for Flutter Web. diff --git a/packages/flutter/test/painting/_test_http_request.dart b/packages/flutter/test/painting/_test_http_request.dart index debd39ee67..a8cf1017dd 100644 --- a/packages/flutter/test/painting/_test_http_request.dart +++ b/packages/flutter/test/painting/_test_http_request.dart @@ -2,7 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:js_interop'; +// For now, we're hiding dart:js_interop's `@JS` to avoid a conflict with +// package:js' `@JS`. In the future, we should be able to remove package:js +// altogether and just import dart:js_interop. +import 'dart:js_interop' hide JS; import 'package:flutter/src/services/dom.dart'; import 'package:js/js.dart';