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: ...@@ -238,11 +238,13 @@ dependencies:
throw 'failed to parse error message: $error'; throw 'failed to parse error message: $error';
} }
final String column = error.substring(colon2 + kColon.length, bullet2); 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) { if (lineNumber == null) {
throw 'failed to parse error message: $error'; throw 'failed to parse error message: $error';
} }
final int columnNumber = int.tryParse(column, radix: 10);
if (columnNumber == null) { if (columnNumber == null) {
throw 'failed to parse error message: $error'; throw 'failed to parse error message: $error';
} }
......
...@@ -384,7 +384,8 @@ class FuchsiaReloadCommand extends FlutterCommand { ...@@ -384,7 +384,8 @@ class FuchsiaReloadCommand extends FlutterCommand {
final int lastSpace = trimmed.lastIndexOf(' '); final int lastSpace = trimmed.lastIndexOf(' ');
final String lastWord = trimmed.substring(lastSpace + 1); final String lastWord = trimmed.substring(lastSpace + 1);
if ((lastWord != '.') && (lastWord != '..')) { if ((lastWord != '.') && (lastWord != '..')) {
final int value = int.tryParse(lastWord); // ignore: deprecated_member_use
final int value = int.parse(lastWord, onError: (_) => null);
if (value != null) if (value != null)
ports.add(value); ports.add(value);
} }
......
...@@ -197,7 +197,8 @@ class FuchsiaRemoteConnection { ...@@ -197,7 +197,8 @@ class FuchsiaRemoteConnection {
final int lastSpace = trimmed.lastIndexOf(' '); final int lastSpace = trimmed.lastIndexOf(' ');
final String lastWord = trimmed.substring(lastSpace + 1); final String lastWord = trimmed.substring(lastSpace + 1);
if ((lastWord != '.') && (lastWord != '..')) { if ((lastWord != '.') && (lastWord != '..')) {
final int value = int.tryParse(lastWord); // ignore: deprecated_member_use
final int value = int.parse(lastWord, onError: (_) => null);
if (value != null) { if (value != null) {
ports.add(value); 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