Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Unified Diff: sdk/lib/core/bool.dart

Issue 54203002: Update documentation on .fromEnvironment. Make bool default be false. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix test. Remove reference to throwing from int.fromEnvironment Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/lib/core_patch.dart ('k') | sdk/lib/core/int.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/bool.dart
diff --git a/sdk/lib/core/bool.dart b/sdk/lib/core/bool.dart
index c4348b7117300303f2ebc949c16a18562749f707..62d48d364080ae9e239a92ae6bd55b6f6fc4431a 100644
--- a/sdk/lib/core/bool.dart
+++ b/sdk/lib/core/bool.dart
@@ -13,10 +13,29 @@ part of dart.core;
*/
class bool {
/**
- * Returns the boolean for the given environment variable [name] or
- * [defaultValue] if [name] is not present.
+ * Returns the boolean value of the environment declaration [name].
+ *
+ * The boolean value of the declaration is `true` if the declared value is
+ * the string `"true"`. Otherwise it is false.
+ *
+ * If `name` is not declared, the result is instead [defaultValue].
+ *
+ * This constructor is equivalent to:
+ *
+ * const String.fromEnvironment(name,
+ * defaultValue: "$defaultValue") == "true"
+ *
+ * Example:
+ *
+ * const loggingFlag = const bool.fromEnvironment("logging");
+ *
+ * If you want to use a different truth-string, you can use the
+ * [String.fromEnvironment] constructor directly:
+ *
+ * const isLoggingOn = (const String.fromEnvironment("logging") == "on");
*/
- external const factory bool.fromEnvironment(String name, {bool defaultValue});
+ external const factory bool.fromEnvironment(String name,
+ {bool defaultValue: false});
/**
* Returns [:"true":] if the receiver is [:true:], or [:"false":] if the
« no previous file with comments | « sdk/lib/_internal/lib/core_patch.dart ('k') | sdk/lib/core/int.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698