mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Closes https://github.com/flutter/flutter/issues/143396 ### Description - Removes `js_util` library usage across the codebase In order to get rid of `dart.library.js_util` in [`kIsWeb`](e8d56b25c0/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:1a88edceb7/pkg/analyzer/lib/src/dart/constant/evaluation.dart (L2908-L2915). So we either have to update this value or wait for the https://github.com/dart-lang/sdk/issues/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
19 lines
709 B
Dart
19 lines
709 B
Dart
// Copyright 2014 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
@TestOn('browser')
|
|
library;
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
// Regression test for: https://github.com/dart-lang/sdk/issues/47207
|
|
// Needs: https://github.com/dart-lang/sdk/commit/6c4593929f067af259113eae5dc1b3b1c04f1035 to pass.
|
|
// Originally here: https://github.com/flutter/engine/pull/28808
|
|
void main() {
|
|
test('Web library environment define exists', () {
|
|
expect(const bool.fromEnvironment('dart.library.js_interop'), isTrue);
|
|
expect(const bool.fromEnvironment('dart.library.someFooLibrary'), isFalse);
|
|
});
|
|
}
|