Update usage of int/String fromEnvironment
Breaking change 40678 requires the constructors int.fromEnvironment and String.fromEnvironment to get new default values for the named parameter `defaultValue`. This CL changes usages of these constructors such that they do not depend on the default value, such that it becomes a non-breaking change for code in the SDK repo to perform the change in sdk and in sdk_nnbd. Change-Id: I82af0e1f92d6cd3618b65c0c50d754ae8c39eb0a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140284 Reviewed-by: Lasse R.H. Nielsen <lrn@google.com> Reviewed-by: Leaf Petersen <leafp@google.com> Commit-Queue: Erik Ernst <eernst@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
46b1f9dbf8
commit
e3af7e724f
@@ -64,9 +64,15 @@ Uri computePackageConfig() {
|
||||
return Uri.base.resolve(".packages");
|
||||
}
|
||||
|
||||
// TODO(eernst): Use `bool.hasEnvironment` below when possible;
|
||||
// for now we use a dual `defaultValue` rewrite.
|
||||
const _dartSdk = (String.fromEnvironment("DART_SDK", defaultValue: "1") ==
|
||||
String.fromEnvironment("DART_SDK", defaultValue: "2"))
|
||||
? String.fromEnvironment("DART_SDK")
|
||||
: null;
|
||||
|
||||
Uri computeDartSdk() {
|
||||
String dartSdkPath = Platform.environment["DART_SDK"] ??
|
||||
const String.fromEnvironment("DART_SDK");
|
||||
String dartSdkPath = Platform.environment["DART_SDK"] ?? _dartSdk;
|
||||
if (dartSdkPath != null) {
|
||||
return Uri.base.resolveUri(new Uri.file(dartSdkPath));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user