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. |
*/ |