Unverified Commit e7154bee authored by Hans Muller's avatar Hans Muller Committed by GitHub

Remove the rest of the uses of Number.tryParse() (#16568)

parent 1c3f6a85
......@@ -238,11 +238,13 @@ dependencies:
throw 'failed to parse error message: $error';
}
final String column = error.substring(colon2 + kColon.length, bullet2);
final int lineNumber = int.tryParse(line, radix: 10);
// ignore: deprecated_member_use
final int lineNumber = int.parse(line, radix: 10, onError: (String source) => throw 'failed to parse error message: $error');
// ignore: deprecated_member_use
final int columnNumber = int.parse(column, radix: 10, onError: (String source) => throw 'failed to parse error message: $error');
if (lineNumber == null) {
throw 'failed to parse error message: $error';
}
final int columnNumber = int.tryParse(column, radix: 10);
if (columnNumber == null) {
throw 'failed to parse error message: $error';
}
......
......@@ -384,7 +384,8 @@ class FuchsiaReloadCommand extends FlutterCommand {
final int lastSpace = trimmed.lastIndexOf(' ');
final String lastWord = trimmed.substring(lastSpace + 1);
if ((lastWord != '.') && (lastWord != '..')) {
final int value = int.tryParse(lastWord);
// ignore: deprecated_member_use
final int value = int.parse(lastWord, onError: (_) => null);
if (value != null)
ports.add(value);
}
......
......@@ -197,7 +197,8 @@ class FuchsiaRemoteConnection {
final int lastSpace = trimmed.lastIndexOf(' ');
final String lastWord = trimmed.substring(lastSpace + 1);
if ((lastWord != '.') && (lastWord != '..')) {
final int value = int.tryParse(lastWord);
// ignore: deprecated_member_use
final int value = int.parse(lastWord, onError: (_) => null);
if (value != null) {
ports.add(value);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment