Remove uses of deprecated constants and change int.parse to int.tryParse (#19575)

* Remove uses of deprecated constants
* Change int.parse to int.tryParse where appropriate
This commit is contained in:
Leaf Petersen
2018-07-20 15:07:24 -07:00
committed by GitHub
parent 35346b4966
commit 32f94443cc
40 changed files with 77 additions and 80 deletions

View File

@@ -210,8 +210,8 @@ class AndroidDevice extends Device {
// Sample output: '22'
final String sdkVersion = await _getProperty('ro.build.version.sdk');
// ignore: deprecated_member_use
final int sdkVersionParsed = int.parse(sdkVersion, onError: (String source) => null);
final int sdkVersionParsed = int.tryParse(sdkVersion);
if (sdkVersionParsed == null) {
printError('Unexpected response from getprop: "$sdkVersion"');
return false;
@@ -822,8 +822,8 @@ class _AndroidDevicePortForwarder extends DevicePortForwarder {
final AndroidDevice device;
static int _extractPort(String portString) {
// ignore: deprecated_member_use
return int.parse(portString.trim(), onError: (_) => null);
return int.tryParse(portString.trim());
}
@override