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

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: Added examples. 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
Index: sdk/lib/core/bool.dart
diff --git a/sdk/lib/core/bool.dart b/sdk/lib/core/bool.dart
index c4348b7117300303f2ebc949c16a18562749f707..ef1515dd3eb5fb79a61d4cf1f69f14643833344a 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:
+ *
+ * var useFlooFlag = const bool.fromEnvironment("floo");
Søren Gjesse 2013/10/31 08:14:30 Maybe write something more useful here, e.g floo -
Lasse Reichstein Nielsen 2013/10/31 11:52:19 Done.
+ *
+ * If you want to use a different truth-string, you can use the
+ * [String.fromEnvironment] constructor directly:
+ *
+ * var isFlooOn = const String.fromEnvironment("flooFlag") == "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

Powered by Google App Engine
This is Rietveld 408576698