Use platform_env instead of dart_env in package:intl tests.
The VM is about to switch to use the CFE's constant evaluator. This change
will break const.fromEnvironment on modular builds (which affects blaze and build_runner).
Because the only purpose of these definitions was to pass arguments to tests, we can
replace them with a runtime Platform.environment variable.
Context: b/129881700 and https://github.com/dart-lang/sdk/issues/36513
PiperOrigin-RevId: 242916034
diff --git a/test/timezone_test_core.dart b/test/timezone_test_core.dart
index e607a81..6b02564 100644
--- a/test/timezone_test_core.dart
+++ b/test/timezone_test_core.dart
@@ -16,10 +16,10 @@
/// running in that time zone, verify that the DateTime offset is one of the
/// expected values.
testTimezone(String timezoneName, {int expectedUtcOffset}) {
- // The VM can be invoked with a "-DPACKAGE_DIR=<directory>" argument to
- // indicate the root of the Intl package. If it is not provided, we assume
- // that the root of the Intl package is the current directory.
- var packageDir = const String.fromEnvironment('PACKAGE_DIR');
+ // Define the environment variable "PACKAGE_DIR=<directory>" to indicate the
+ // root of the Intl package. If it is not provided, we assume that the root of
+ // the Intl package is the current directory.
+ var packageDir = Platform.environment['PACKAGE_DIR'];
var packageRelative = 'test/timezone_local_even_test_helper.dart';
var fileToSpawn =
packageDir == null ? packageRelative : '$packageDir/$packageRelative';