Index: sdk/lib/core/int.dart |
diff --git a/sdk/lib/core/int.dart b/sdk/lib/core/int.dart |
index 681b8e8815a4f0f166fbc22c51cf92de08d781a9..1d29a728f0399e2c16059fa1bb0ec26b69d29c8b 100644 |
--- a/sdk/lib/core/int.dart |
+++ b/sdk/lib/core/int.dart |
@@ -277,6 +277,13 @@ abstract class int extends num { |
* value is used instead. If no [onError] is provided, a [FormatException] |
* is thrown. |
* |
+ * The [onError] handler can be chosen to return `null`. This is preferable |
+ * to to throwing and then immediately catching the [FormatException]. |
+ * Example: |
+ * |
+ * var value = int.parse(text, onError: (source) => null); |
+ * if (value == null) ... handle the problem |
+ * |
* The [onError] function is only invoked if [source] is a [String]. It is |
* not invoked if the [source] is, for example, `null`. |
*/ |