Re-land "Clean up the use of deprecated API in the analyzer_plugin package".

int.tryParse is now available to internal Google users, so it is safe
to land this change now.

This reverts commit 115850ca1d.
Original commit 86ba29265a.

Change-Id: I92c3d19533d3108c06910f21070266953c3a065b
Reviewed-on: https://dart-review.googlesource.com/53244
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This commit is contained in:
Paul Berry 2018-05-01 21:08:04 +00:00 committed by commit-bot@chromium.org
parent 607f4f5769
commit 73abd61304

View file

@ -277,9 +277,11 @@ abstract class JsonDecoder {
if (json is int) {
return json;
} else if (json is String) {
return int.parse(json, onError: (String value) {
int value = int.tryParse(json);
if (value == null) {
throw mismatch(jsonPath, 'int', json);
});
}
return value;
}
throw mismatch(jsonPath, 'int', json);
}