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

Unified Diff: pkg/analyzer/lib/src/generated/utilities_general.dart

Issue 1686613002: Use different SDKs based on option settings (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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: pkg/analyzer/lib/src/generated/utilities_general.dart
diff --git a/pkg/analyzer/lib/src/generated/utilities_general.dart b/pkg/analyzer/lib/src/generated/utilities_general.dart
index 1adc883093675f7e8887f0e2a76c069e988c2e4a..e0600dcfcf64b48f41823ed475c97cb025c17984 100644
--- a/pkg/analyzer/lib/src/generated/utilities_general.dart
+++ b/pkg/analyzer/lib/src/generated/utilities_general.dart
@@ -20,6 +20,24 @@ bool isTrue(Object value) =>
value is bool ? value : toLowerCase(value) == 'true';
/**
+ * Safely convert the given [value] to a bool value, or return `null` if the
+ * value coult not be converted.
+ */
+bool toBool(Object value) {
+ if (value is bool) {
+ return value;
+ }
+ String string = toLowerCase(value);
+ if (string == 'true') {
+ return true;
+ }
+ if (string == 'false') {
+ return false;
+ }
+ return null;
+}
+
+/**
* Safely convert this [value] to lower case, returning `null` if [value] is
* null.
*/

Powered by Google App Engine
This is Rietveld 408576698