{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/33246","repository_url":"https://api.github.com/repos/dart-lang/sdk","labels_url":"https://api.github.com/repos/dart-lang/sdk/issues/33246/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/sdk/issues/33246/comments","events_url":"https://api.github.com/repos/dart-lang/sdk/issues/33246/events","html_url":"https://github.com/dart-lang/sdk/issues/33246","id":326754152,"number":33246,"title":"Improve tryParse null handling","user":{"login":"Rockvole","id":4139576,"avatar_url":"https://avatars2.githubusercontent.com/u/4139576?v=4","gravatar_id":"","url":"https://api.github.com/users/Rockvole","html_url":"https://github.com/Rockvole","followers_url":"https://api.github.com/users/Rockvole/followers","following_url":"https://api.github.com/users/Rockvole/following{/other_user}","gists_url":"https://api.github.com/users/Rockvole/gists{/gist_id}","starred_url":"https://api.github.com/users/Rockvole/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rockvole/subscriptions","organizations_url":"https://api.github.com/users/Rockvole/orgs","repos_url":"https://api.github.com/users/Rockvole/repos","events_url":"https://api.github.com/users/Rockvole/events{/privacy}","received_events_url":"https://api.github.com/users/Rockvole/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-26T17:24:42Z","updated_at":"2018-05-26T17:42:35Z","closed_at":null,"author_association":"NONE","body":"It would be better if tryParse() dealt with null better. I think it is a common requirement.\r\n\r\n    int.tryParse(null) ?? 0;\r\n\r\n    Unhandled exception:\r\n    Invalid argument(s): The source must not be null\r\n    #0      int.tryParse (dart:core-patch/dart:core/integers_patch.dart:112)\r\n    #1      main (file:///work/projects/dart/kbml_parser/main_test.dart:11:7)\r\n    #2      _startIsolate.<anonymous closure> (dart:isolate-patch/dart:isolate/isolate_patch.dart:279)\r\n    #3      _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:165)\r\n\r\n    dart --version\r\n    Dart VM version: 2.0.0-dev.58.0 (Unknown timestamp) on \"linux_x64\"\r\n"},"comment":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/comments/392276836","html_url":"https://github.com/dart-lang/sdk/issues/33246#issuecomment-392276836","issue_url":"https://api.github.com/repos/dart-lang/sdk/issues/33246","id":392276836,"user":{"login":"Rockvole","id":4139576,"avatar_url":"https://avatars2.githubusercontent.com/u/4139576?v=4","gravatar_id":"","url":"https://api.github.com/users/Rockvole","html_url":"https://github.com/Rockvole","followers_url":"https://api.github.com/users/Rockvole/followers","following_url":"https://api.github.com/users/Rockvole/following{/other_user}","gists_url":"https://api.github.com/users/Rockvole/gists{/gist_id}","starred_url":"https://api.github.com/users/Rockvole/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rockvole/subscriptions","organizations_url":"https://api.github.com/users/Rockvole/orgs","repos_url":"https://api.github.com/users/Rockvole/repos","events_url":"https://api.github.com/users/Rockvole/events{/privacy}","received_events_url":"https://api.github.com/users/Rockvole/received_events","type":"User","site_admin":false},"created_at":"2018-05-26T17:42:35Z","updated_at":"2018-05-26T17:42:35Z","author_association":"NONE","body":"This is my working code :\r\n\r\n    int i=cellAttributeMap[\"colspan\"]!=null?int.tryParse(cellAttributeMap[\"colspan\"]):null;\r\n\r\nI thought tryParse would allow :\r\n\r\n    int i=int.tryParse(cellAttributeMap[\"colspan\"]);\r\n\r\nSetting i to be null when cellAttributeMap[\"colspan\"] is null.\r\n"}}
{"actor":{"display_login":"Rockvole"}}