Index: sdk/lib/core/string.dart |
diff --git a/sdk/lib/core/string.dart b/sdk/lib/core/string.dart |
index ed352e4b03534cba92a2bad0c71a78a6f59b7106..4e69f65a4a86d182ed34163a6a8b99e55bc733b7 100644 |
--- a/sdk/lib/core/string.dart |
+++ b/sdk/lib/core/string.dart |
@@ -143,6 +143,12 @@ abstract class String implements Comparable<String>, Pattern { |
* |
* var isDeclared = const String.fromEnvironment("maybeDeclared") != null; |
*/ |
+ // The .fromEnvironment() constructors are special in that we do not want |
+ // users to call them using "new". We prohibit that by giving them bodies |
+ // that throw, even though const constructors are not allowed to have bodies. |
+ // Disable those static errors. |
+ //ignore: const_constructor_with_body |
+ //ignore: const_factory |
external const factory String.fromEnvironment(String name, |
{String defaultValue}); |