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:
@@ -11,7 +11,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
test('test smoke test -- this test should fail', () async {
|
||||
if (system.Process.killPid(system.pid, system.ProcessSignal.SIGSEGV)) { // ignore: deprecated_member_use
|
||||
if (system.Process.killPid(system.pid, system.ProcessSignal.sigsegv)) {
|
||||
print('system.Process.killPid returned before the process ended!');
|
||||
print('Sleeping for a few seconds just in case signal delivery is delayed or our signal handler is being slow...');
|
||||
system.sleep(const Duration(seconds: 10)); // don't sleep too much, we must not time out
|
||||
|
||||
@@ -8,5 +8,5 @@ import 'dart:io' as system;
|
||||
// see //flutter/dev/bots/test.dart
|
||||
|
||||
void main() {
|
||||
system.Process.killPid(system.pid, system.ProcessSignal.SIGSEGV); // ignore: deprecated_member_use
|
||||
system.Process.killPid(system.pid, system.ProcessSignal.sigsegv);
|
||||
}
|
||||
|
||||
@@ -240,10 +240,10 @@ dependencies:
|
||||
throw 'failed to parse error message: $error';
|
||||
}
|
||||
final String column = error.substring(colon2 + kColon.length, bullet2);
|
||||
// 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');
|
||||
|
||||
final int lineNumber = int.tryParse(line, radix: 10);
|
||||
|
||||
final int columnNumber = int.tryParse(column, radix: 10);
|
||||
if (lineNumber == null) {
|
||||
throw 'failed to parse error message: $error';
|
||||
}
|
||||
|
||||
@@ -176,8 +176,8 @@ class FlutterProject {
|
||||
final File buildScript = new File(
|
||||
path.join(androidPath, 'app', 'build.gradle'),
|
||||
);
|
||||
// ignore: deprecated_member_use
|
||||
buildScript.openWrite(mode: FileMode.APPEND).write('''
|
||||
|
||||
buildScript.openWrite(mode: FileMode.append).write('''
|
||||
|
||||
android {
|
||||
buildTypes {
|
||||
@@ -193,8 +193,8 @@ android {
|
||||
final File buildScript = new File(
|
||||
path.join(androidPath, 'app', 'build.gradle'),
|
||||
);
|
||||
// ignore: deprecated_member_use
|
||||
buildScript.openWrite(mode: FileMode.APPEND).write('''
|
||||
|
||||
buildScript.openWrite(mode: FileMode.append).write('''
|
||||
|
||||
android {
|
||||
flavorDimensions "mode"
|
||||
|
||||
@@ -52,7 +52,7 @@ Future<Null> _patchXcconfigFilesIfNotPatched(String flutterProjectPath) async {
|
||||
final String contents = await file.readAsString();
|
||||
final bool alreadyPatched = contents.contains(include);
|
||||
if (!alreadyPatched) {
|
||||
final IOSink patchOut = file.openWrite(mode: FileMode.APPEND); // ignore: deprecated_member_use
|
||||
final IOSink patchOut = file.openWrite(mode: FileMode.append);
|
||||
patchOut.writeln(); // in case EOF is not preceded by line break
|
||||
patchOut.writeln(include);
|
||||
await patchOut.close();
|
||||
|
||||
@@ -73,14 +73,14 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent = false }) a
|
||||
await runner.exitCode.timeout(const Duration(seconds: 1));
|
||||
return taskResult;
|
||||
} on TimeoutException catch (timeout) {
|
||||
runner.kill(ProcessSignal.SIGINT); // ignore: deprecated_member_use
|
||||
runner.kill(ProcessSignal.sigint);
|
||||
return <String, dynamic>{
|
||||
'success': false,
|
||||
'reason': 'Timeout waiting for $waitingFor: ${timeout.message}',
|
||||
};
|
||||
} finally {
|
||||
if (!runnerFinished)
|
||||
runner.kill(ProcessSignal.SIGKILL); // ignore: deprecated_member_use
|
||||
runner.kill(ProcessSignal.sigkill);
|
||||
await stdoutSub.cancel();
|
||||
await stderrSub.cancel();
|
||||
}
|
||||
|
||||
@@ -124,8 +124,8 @@ Future<Map<String, double>> _readJsonResults(Process process) {
|
||||
jsonStarted = false;
|
||||
processWasKilledIntentionally = true;
|
||||
resultsHaveBeenParsed = true;
|
||||
// ignore: deprecated_member_use
|
||||
process.kill(ProcessSignal.SIGINT); // flutter run doesn't quit automatically
|
||||
|
||||
process.kill(ProcessSignal.sigint); // flutter run doesn't quit automatically
|
||||
try {
|
||||
completer.complete(new Map<String, double>.from(json.decode(jsonOutput)));
|
||||
} catch (ex) {
|
||||
|
||||
Reference in New Issue
Block a user