Unverified Commit 32f94443 authored by Leaf Petersen's avatar Leaf Petersen Committed by GitHub

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
parent 35346b49
...@@ -11,7 +11,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -11,7 +11,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
test('test smoke test -- this test should fail', () async { 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('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...'); 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 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; ...@@ -8,5 +8,5 @@ import 'dart:io' as system;
// see //flutter/dev/bots/test.dart // see //flutter/dev/bots/test.dart
void main() { 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: ...@@ -240,10 +240,10 @@ 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);
// ignore: deprecated_member_use
final int lineNumber = int.parse(line, radix: 10, onError: (String source) => throw 'failed to parse error message: $error'); final int lineNumber = int.tryParse(line, radix: 10);
// ignore: deprecated_member_use
final int columnNumber = int.parse(column, radix: 10, onError: (String source) => throw 'failed to parse error message: $error'); final int columnNumber = int.tryParse(column, radix: 10);
if (lineNumber == null) { if (lineNumber == null) {
throw 'failed to parse error message: $error'; throw 'failed to parse error message: $error';
} }
......
...@@ -176,8 +176,8 @@ class FlutterProject { ...@@ -176,8 +176,8 @@ class FlutterProject {
final File buildScript = new File( final File buildScript = new File(
path.join(androidPath, 'app', 'build.gradle'), path.join(androidPath, 'app', 'build.gradle'),
); );
// ignore: deprecated_member_use
buildScript.openWrite(mode: FileMode.APPEND).write(''' buildScript.openWrite(mode: FileMode.append).write('''
android { android {
buildTypes { buildTypes {
...@@ -193,8 +193,8 @@ android { ...@@ -193,8 +193,8 @@ android {
final File buildScript = new File( final File buildScript = new File(
path.join(androidPath, 'app', 'build.gradle'), path.join(androidPath, 'app', 'build.gradle'),
); );
// ignore: deprecated_member_use
buildScript.openWrite(mode: FileMode.APPEND).write(''' buildScript.openWrite(mode: FileMode.append).write('''
android { android {
flavorDimensions "mode" flavorDimensions "mode"
......
...@@ -52,7 +52,7 @@ Future<Null> _patchXcconfigFilesIfNotPatched(String flutterProjectPath) async { ...@@ -52,7 +52,7 @@ Future<Null> _patchXcconfigFilesIfNotPatched(String flutterProjectPath) async {
final String contents = await file.readAsString(); final String contents = await file.readAsString();
final bool alreadyPatched = contents.contains(include); final bool alreadyPatched = contents.contains(include);
if (!alreadyPatched) { 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(); // in case EOF is not preceded by line break
patchOut.writeln(include); patchOut.writeln(include);
await patchOut.close(); await patchOut.close();
......
...@@ -73,14 +73,14 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent = false }) a ...@@ -73,14 +73,14 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent = false }) a
await runner.exitCode.timeout(const Duration(seconds: 1)); await runner.exitCode.timeout(const Duration(seconds: 1));
return taskResult; return taskResult;
} on TimeoutException catch (timeout) { } on TimeoutException catch (timeout) {
runner.kill(ProcessSignal.SIGINT); // ignore: deprecated_member_use runner.kill(ProcessSignal.sigint);
return <String, dynamic>{ return <String, dynamic>{
'success': false, 'success': false,
'reason': 'Timeout waiting for $waitingFor: ${timeout.message}', 'reason': 'Timeout waiting for $waitingFor: ${timeout.message}',
}; };
} finally { } finally {
if (!runnerFinished) if (!runnerFinished)
runner.kill(ProcessSignal.SIGKILL); // ignore: deprecated_member_use runner.kill(ProcessSignal.sigkill);
await stdoutSub.cancel(); await stdoutSub.cancel();
await stderrSub.cancel(); await stderrSub.cancel();
} }
......
...@@ -124,8 +124,8 @@ Future<Map<String, double>> _readJsonResults(Process process) { ...@@ -124,8 +124,8 @@ Future<Map<String, double>> _readJsonResults(Process process) {
jsonStarted = false; jsonStarted = false;
processWasKilledIntentionally = true; processWasKilledIntentionally = true;
resultsHaveBeenParsed = 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 { try {
completer.complete(new Map<String, double>.from(json.decode(jsonOutput))); completer.complete(new Map<String, double>.from(json.decode(jsonOutput)));
} catch (ex) { } catch (ex) {
......
...@@ -373,7 +373,7 @@ class FlutterDriver { ...@@ -373,7 +373,7 @@ class FlutterDriver {
if (_logCommunicationToFile) { if (_logCommunicationToFile) {
final f.File file = fs.file(p.join(testOutputsDirectory, 'flutter_driver_commands_$_driverId.log')); final f.File file = fs.file(p.join(testOutputsDirectory, 'flutter_driver_commands_$_driverId.log'));
file.createSync(recursive: true); // no-op if file exists file.createSync(recursive: true); // no-op if file exists
file.writeAsStringSync('${new DateTime.now()} $message\n', mode: f.FileMode.APPEND, flush: true); // ignore: deprecated_member_use file.writeAsStringSync('${new DateTime.now()} $message\n', mode: f.FileMode.append, flush: true);
} }
} }
......
...@@ -236,8 +236,8 @@ class GoldensClient { ...@@ -236,8 +236,8 @@ class GoldensClient {
Future<void> _obtainLock() async { Future<void> _obtainLock() async {
final File lockFile = flutterRoot.childFile(fs.path.join('bin', 'cache', 'goldens.lockfile')); final File lockFile = flutterRoot.childFile(fs.path.join('bin', 'cache', 'goldens.lockfile'));
await lockFile.create(recursive: true); await lockFile.create(recursive: true);
_lock = await lockFile.open(mode: io.FileMode.WRITE); // ignore: deprecated_member_use _lock = await lockFile.open(mode: io.FileMode.write);
await _lock.lock(io.FileLock.BLOCKING_EXCLUSIVE); // ignore: deprecated_member_use await _lock.lock(io.FileLock.blockingExclusive);
} }
Future<void> _releaseLock() async { Future<void> _releaseLock() async {
......
...@@ -210,8 +210,8 @@ class AndroidDevice extends Device { ...@@ -210,8 +210,8 @@ class AndroidDevice extends Device {
// Sample output: '22' // Sample output: '22'
final String sdkVersion = await _getProperty('ro.build.version.sdk'); 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) { if (sdkVersionParsed == null) {
printError('Unexpected response from getprop: "$sdkVersion"'); printError('Unexpected response from getprop: "$sdkVersion"');
return false; return false;
...@@ -822,8 +822,8 @@ class _AndroidDevicePortForwarder extends DevicePortForwarder { ...@@ -822,8 +822,8 @@ class _AndroidDevicePortForwarder extends DevicePortForwarder {
final AndroidDevice device; final AndroidDevice device;
static int _extractPort(String portString) { static int _extractPort(String portString) {
// ignore: deprecated_member_use
return int.parse(portString.trim(), onError: (_) => null); return int.tryParse(portString.trim());
} }
@override @override
......
...@@ -80,7 +80,7 @@ class _ManifestAssetBundle implements AssetBundle { ...@@ -80,7 +80,7 @@ class _ManifestAssetBundle implements AssetBundle {
return true; return true;
final FileStat stat = fs.file(manifestPath).statSync(); final FileStat stat = fs.file(manifestPath).statSync();
if (stat.type == FileSystemEntityType.NOT_FOUND) // ignore: deprecated_member_use if (stat.type == FileSystemEntityType.notFound)
return true; return true;
return stat.modified.isAfter(_lastBuildTimestamp); return stat.modified.isAfter(_lastBuildTimestamp);
......
...@@ -104,15 +104,15 @@ void copyDirectorySync(Directory srcDir, Directory destDir, [void onFileCopied(F ...@@ -104,15 +104,15 @@ void copyDirectorySync(Directory srcDir, Directory destDir, [void onFileCopied(F
Directory getRecordingSink(String dirname, String basename) { Directory getRecordingSink(String dirname, String basename) {
final String location = _kLocalFs.path.join(dirname, basename); final String location = _kLocalFs.path.join(dirname, basename);
switch (_kLocalFs.typeSync(location, followLinks: false)) { switch (_kLocalFs.typeSync(location, followLinks: false)) {
case FileSystemEntityType.FILE: // ignore: deprecated_member_use case FileSystemEntityType.file:
case FileSystemEntityType.LINK: // ignore: deprecated_member_use case FileSystemEntityType.link:
throwToolExit('Invalid record-to location: $dirname ("$basename" exists as non-directory)'); throwToolExit('Invalid record-to location: $dirname ("$basename" exists as non-directory)');
break; break;
case FileSystemEntityType.DIRECTORY: // ignore: deprecated_member_use case FileSystemEntityType.directory:
if (_kLocalFs.directory(location).listSync(followLinks: false).isNotEmpty) if (_kLocalFs.directory(location).listSync(followLinks: false).isNotEmpty)
throwToolExit('Invalid record-to location: $dirname ("$basename" is not empty)'); throwToolExit('Invalid record-to location: $dirname ("$basename" is not empty)');
break; break;
case FileSystemEntityType.NOT_FOUND: // ignore: deprecated_member_use case FileSystemEntityType.notFound:
_kLocalFs.directory(location).createSync(recursive: true); _kLocalFs.directory(location).createSync(recursive: true);
} }
return _kLocalFs.directory(location); return _kLocalFs.directory(location);
......
...@@ -41,7 +41,7 @@ export 'dart:io' ...@@ -41,7 +41,7 @@ export 'dart:io'
exitCode, exitCode,
// File NO! Use `file_system.dart` // File NO! Use `file_system.dart`
// FileSystemEntity NO! Use `file_system.dart` // FileSystemEntity NO! Use `file_system.dart`
GZIP, // ignore: deprecated_member_use gzip,
HandshakeException, HandshakeException,
HttpClient, HttpClient,
HttpClientRequest, HttpClientRequest,
...@@ -71,7 +71,7 @@ export 'dart:io' ...@@ -71,7 +71,7 @@ export 'dart:io'
// stdout, NO! Use `io.dart` // stdout, NO! Use `io.dart`
Socket, Socket,
SocketException, SocketException,
SYSTEM_ENCODING, // ignore: deprecated_member_use systemEncoding,
WebSocket, WebSocket,
WebSocketException, WebSocketException,
WebSocketTransformer; WebSocketTransformer;
......
...@@ -213,7 +213,7 @@ Future<Process> runDetached(List<String> cmd) { ...@@ -213,7 +213,7 @@ Future<Process> runDetached(List<String> cmd) {
_traceCommand(cmd); _traceCommand(cmd);
final Future<Process> proc = processManager.start( final Future<Process> proc = processManager.start(
cmd, cmd,
mode: ProcessStartMode.DETACHED, // ignore: deprecated_member_use mode: ProcessStartMode.detached,
); );
return proc; return proc;
} }
......
...@@ -74,7 +74,7 @@ class Cache { ...@@ -74,7 +74,7 @@ class Cache {
if (!_lockEnabled) if (!_lockEnabled)
return null; return null;
assert(_lock == null); assert(_lock == null);
_lock = await fs.file(fs.path.join(flutterRoot, 'bin', 'cache', 'lockfile')).open(mode: FileMode.WRITE); // ignore: deprecated_member_use _lock = await fs.file(fs.path.join(flutterRoot, 'bin', 'cache', 'lockfile')).open(mode: FileMode.write);
bool locked = false; bool locked = false;
bool printed = false; bool printed = false;
while (!locked) { while (!locked) {
......
...@@ -26,7 +26,7 @@ abstract class AnalyzeBase { ...@@ -26,7 +26,7 @@ abstract class AnalyzeBase {
void dumpErrors(Iterable<String> errors) { void dumpErrors(Iterable<String> errors) {
if (argResults['write'] != null) { if (argResults['write'] != null) {
try { try {
final RandomAccessFile resultsFile = fs.file(argResults['write']).openSync(mode: FileMode.WRITE); // ignore: deprecated_member_use final RandomAccessFile resultsFile = fs.file(argResults['write']).openSync(mode: FileMode.write);
try { try {
resultsFile.lockSync(); resultsFile.lockSync();
resultsFile.writeStringSync(errors.join('\n')); resultsFile.writeStringSync(errors.join('\n'));
......
...@@ -47,9 +47,9 @@ class AnalyzeOnce extends AnalyzeBase { ...@@ -47,9 +47,9 @@ class AnalyzeOnce extends AnalyzeBase {
for (String directory in directories) { for (String directory in directories) {
final FileSystemEntityType type = fs.typeSync(directory); final FileSystemEntityType type = fs.typeSync(directory);
if (type == FileSystemEntityType.NOT_FOUND) { // ignore: deprecated_member_use if (type == FileSystemEntityType.notFound) {
throwToolExit("'$directory' does not exist"); throwToolExit("'$directory' does not exist");
} else if (type != FileSystemEntityType.DIRECTORY) { // ignore: deprecated_member_use } else if (type != FileSystemEntityType.directory) {
throwToolExit("'$directory' is not a directory"); throwToolExit("'$directory' is not a directory");
} }
} }
......
...@@ -453,12 +453,12 @@ String _validateProjectDir(String dirPath, { String flutterRoot }) { ...@@ -453,12 +453,12 @@ String _validateProjectDir(String dirPath, { String flutterRoot }) {
final FileSystemEntityType type = fs.typeSync(dirPath); final FileSystemEntityType type = fs.typeSync(dirPath);
if (type != FileSystemEntityType.NOT_FOUND) { // ignore: deprecated_member_use if (type != FileSystemEntityType.notFound) {
switch (type) { switch (type) {
case FileSystemEntityType.FILE: // ignore: deprecated_member_use case FileSystemEntityType.file:
// Do not overwrite files. // Do not overwrite files.
return "Invalid project name: '$dirPath' - file exists."; return "Invalid project name: '$dirPath' - file exists.";
case FileSystemEntityType.LINK: // ignore: deprecated_member_use case FileSystemEntityType.link:
// Do not overwrite links. // Do not overwrite links.
return "Invalid project name: '$dirPath' - refers to a link."; return "Invalid project name: '$dirPath' - refers to a link.";
} }
......
...@@ -94,7 +94,7 @@ class DriveCommand extends RunCommandBase { ...@@ -94,7 +94,7 @@ class DriveCommand extends RunCommandBase {
if (device == null) if (device == null)
throwToolExit(null); throwToolExit(null);
if (await fs.type(testFile) != FileSystemEntityType.FILE) // ignore: deprecated_member_use if (await fs.type(testFile) != FileSystemEntityType.file)
throwToolExit('Test file not found: $testFile'); throwToolExit('Test file not found: $testFile');
String observatoryUri; String observatoryUri;
...@@ -225,7 +225,7 @@ void restoreAppStarter() { ...@@ -225,7 +225,7 @@ void restoreAppStarter() {
Future<LaunchResult> _startApp(DriveCommand command) async { Future<LaunchResult> _startApp(DriveCommand command) async {
final String mainPath = findMainDartFile(command.targetFile); final String mainPath = findMainDartFile(command.targetFile);
if (await fs.type(mainPath) != FileSystemEntityType.FILE) { // ignore: deprecated_member_use if (await fs.type(mainPath) != FileSystemEntityType.file) {
printError('Tried to run $mainPath, but that file does not exist.'); printError('Tried to run $mainPath, but that file does not exist.');
return null; return null;
} }
......
...@@ -27,7 +27,7 @@ import '../vmservice.dart'; ...@@ -27,7 +27,7 @@ import '../vmservice.dart';
// $ flutter fuchsia_reload -f ~/fuchsia -a 192.168.1.39 \ // $ flutter fuchsia_reload -f ~/fuchsia -a 192.168.1.39 \
// -g //lib/flutter/examples/flutter_gallery:flutter_gallery // -g //lib/flutter/examples/flutter_gallery:flutter_gallery
final String ipv4Loopback = InternetAddress.LOOPBACK_IP_V4.address; // ignore: deprecated_member_use final String ipv4Loopback = InternetAddress.loopbackIPv4.address;
class FuchsiaReloadCommand extends FlutterCommand { class FuchsiaReloadCommand extends FlutterCommand {
FuchsiaReloadCommand() { FuchsiaReloadCommand() {
...@@ -386,8 +386,8 @@ class FuchsiaReloadCommand extends FlutterCommand { ...@@ -386,8 +386,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 != '..')) {
// ignore: deprecated_member_use
final int value = int.parse(lastWord, onError: (_) => null); final int value = int.tryParse(lastWord);
if (value != null) if (value != null)
ports.add(value); ports.add(value);
} }
......
...@@ -261,9 +261,9 @@ class IdeConfigCommand extends FlutterCommand { ...@@ -261,9 +261,9 @@ class IdeConfigCommand extends FlutterCommand {
String _validateFlutterDir(String dirPath, {String flutterRoot}) { String _validateFlutterDir(String dirPath, {String flutterRoot}) {
final FileSystemEntityType type = fs.typeSync(dirPath); final FileSystemEntityType type = fs.typeSync(dirPath);
if (type != FileSystemEntityType.NOT_FOUND) { // ignore: deprecated_member_use if (type != FileSystemEntityType.notFound) {
switch (type) { switch (type) {
case FileSystemEntityType.LINK: // ignore: deprecated_member_use case FileSystemEntityType.link:
// Do not overwrite links. // Do not overwrite links.
return "Invalid project root dir: '$dirPath' - refers to a link."; return "Invalid project root dir: '$dirPath' - refers to a link.";
} }
......
...@@ -785,8 +785,8 @@ class PubspecChecksum extends PubspecLine { ...@@ -785,8 +785,8 @@ class PubspecChecksum extends PubspecLine {
if (twoLines.length != 2) { if (twoLines.length != 2) {
return new PubspecChecksum(-1, line); return new PubspecChecksum(-1, line);
} }
// ignore: deprecated_member_use
final int value = int.parse(twoLines.last.trim(), radix: 16, onError: (String _) => -1); final int value = int.tryParse(twoLines.last.trim(), radix: 16) ?? -1;
return new PubspecChecksum(value, line); return new PubspecChecksum(value, line);
} }
} }
......
...@@ -30,7 +30,7 @@ class DependencyChecker { ...@@ -30,7 +30,7 @@ class DependencyChecker {
for (String path in _dependencies) { for (String path in _dependencies) {
final File file = fs.file(path); final File file = fs.file(path);
final FileStat stat = file.statSync(); final FileStat stat = file.statSync();
if (stat.type == FileSystemEntityType.NOT_FOUND) { // ignore: deprecated_member_use if (stat.type == FileSystemEntityType.notFound) {
printTrace('DependencyChecker: Error stating $path.'); printTrace('DependencyChecker: Error stating $path.');
return true; return true;
} }
......
...@@ -46,7 +46,7 @@ abstract class DevFSContent { ...@@ -46,7 +46,7 @@ abstract class DevFSContent {
Stream<List<int>> contentsAsStream(); Stream<List<int>> contentsAsStream();
Stream<List<int>> contentsAsCompressedStream() { Stream<List<int>> contentsAsCompressedStream() {
return contentsAsStream().transform(GZIP.encoder); // ignore: deprecated_member_use return contentsAsStream().transform(gzip.encoder);
} }
/// Return the list of files this content depends on. /// Return the list of files this content depends on.
...@@ -86,7 +86,7 @@ class DevFSFileContent extends DevFSContent { ...@@ -86,7 +86,7 @@ class DevFSFileContent extends DevFSContent {
return; return;
} }
_fileStat = file.statSync(); _fileStat = file.statSync();
if (_fileStat.type == FileSystemEntityType.LINK) { // ignore: deprecated_member_use if (_fileStat.type == FileSystemEntityType.link) {
// Resolve, stat, and maybe cache the symlink target. // Resolve, stat, and maybe cache the symlink target.
final String resolved = file.resolveSymbolicLinksSync(); final String resolved = file.resolveSymbolicLinksSync();
final FileSystemEntity linkTarget = fs.file(resolved); final FileSystemEntity linkTarget = fs.file(resolved);
...@@ -666,7 +666,7 @@ class DevFS { ...@@ -666,7 +666,7 @@ class DevFS {
try { try {
final FileSystemEntityType linkType = final FileSystemEntityType linkType =
fs.statSync(file.resolveSymbolicLinksSync()).type; fs.statSync(file.resolveSymbolicLinksSync()).type;
if (linkType == FileSystemEntityType.DIRECTORY) // ignore: deprecated_member_use if (linkType == FileSystemEntityType.directory)
continue; continue;
} on FileSystemException catch (e) { } on FileSystemException catch (e) {
_printScanDirectoryError(file.path, e); _printScanDirectoryError(file.path, e);
......
...@@ -582,7 +582,7 @@ void _copyServiceDefinitionsManifest(List<Map<String, String>> services, File ma ...@@ -582,7 +582,7 @@ void _copyServiceDefinitionsManifest(List<Map<String, String>> services, File ma
'framework': fs.path.basenameWithoutExtension(service['ios-framework']) 'framework': fs.path.basenameWithoutExtension(service['ios-framework'])
}).toList(); }).toList();
final Map<String, dynamic> jsonObject = <String, dynamic>{ 'services' : jsonServices }; final Map<String, dynamic> jsonObject = <String, dynamic>{ 'services' : jsonServices };
manifest.writeAsStringSync(json.encode(jsonObject), mode: FileMode.WRITE, flush: true); // ignore: deprecated_member_use manifest.writeAsStringSync(json.encode(jsonObject), mode: FileMode.write, flush: true);
} }
Future<bool> upgradePbxProjWithFlutterAssets(String app, String appPath) async { Future<bool> upgradePbxProjWithFlutterAssets(String app, String appPath) async {
......
...@@ -435,7 +435,7 @@ class IOSSimulator extends Device { ...@@ -435,7 +435,7 @@ class IOSSimulator extends Device {
void clearLogs() { void clearLogs() {
final File logFile = fs.file(logFilePath); final File logFile = fs.file(logFilePath);
if (logFile.existsSync()) { if (logFile.existsSync()) {
final RandomAccessFile randomFile = logFile.openSync(mode: FileMode.WRITE); // ignore: deprecated_member_use final RandomAccessFile randomFile = logFile.openSync(mode: FileMode.write);
randomFile.truncateSync(0); randomFile.truncateSync(0);
randomFile.closeSync(); randomFile.closeSync();
} }
......
...@@ -105,6 +105,6 @@ File generateServiceDefinitions( ...@@ -105,6 +105,6 @@ File generateServiceDefinitions(
final Map<String, dynamic> jsonObject = <String, dynamic>{ 'services': services }; final Map<String, dynamic> jsonObject = <String, dynamic>{ 'services': services };
final File servicesFile = fs.file(fs.path.join(dir, 'services.json')); final File servicesFile = fs.file(fs.path.join(dir, 'services.json'));
servicesFile.writeAsStringSync(json.encode(jsonObject), mode: FileMode.WRITE, flush: true); // ignore: deprecated_member_use servicesFile.writeAsStringSync(json.encode(jsonObject), mode: FileMode.write, flush: true);
return servicesFile; return servicesFile;
} }
...@@ -52,8 +52,8 @@ const String _kProjectRootSentinel = 'pubspec.yaml'; ...@@ -52,8 +52,8 @@ const String _kProjectRootSentinel = 'pubspec.yaml';
/// The address at which our WebSocket server resides and at which the sky_shell /// The address at which our WebSocket server resides and at which the sky_shell
/// processes will host the Observatory server. /// processes will host the Observatory server.
final Map<InternetAddressType, InternetAddress> _kHosts = <InternetAddressType, InternetAddress>{ final Map<InternetAddressType, InternetAddress> _kHosts = <InternetAddressType, InternetAddress>{
InternetAddressType.IP_V4: InternetAddress.LOOPBACK_IP_V4, // ignore: deprecated_member_use InternetAddressType.IPv4: InternetAddress.loopbackIPv4,
InternetAddressType.IP_V6: InternetAddress.LOOPBACK_IP_V6, // ignore: deprecated_member_use InternetAddressType.IPv6: InternetAddress.loopbackIPv6,
}; };
/// Configure the `test` package to work with Flutter. /// Configure the `test` package to work with Flutter.
...@@ -73,7 +73,7 @@ void installHook({ ...@@ -73,7 +73,7 @@ void installHook({
bool trackWidgetCreation = false, bool trackWidgetCreation = false,
bool updateGoldens = false, bool updateGoldens = false,
int observatoryPort, int observatoryPort,
InternetAddressType serverType = InternetAddressType.IP_V4, // ignore: deprecated_member_use InternetAddressType serverType = InternetAddressType.IPv4,
}) { }) {
assert(!enableObservatory || (!startPaused && observatoryPort == null)); assert(!enableObservatory || (!startPaused && observatoryPort == null));
hack.registerPlatformPlugin( hack.registerPlatformPlugin(
...@@ -120,7 +120,7 @@ String generateTestBootstrap({ ...@@ -120,7 +120,7 @@ String generateTestBootstrap({
assert(host != null); assert(host != null);
assert(updateGoldens != null); assert(updateGoldens != null);
final String websocketUrl = host.type == InternetAddressType.IP_V4 // ignore: deprecated_member_use final String websocketUrl = host.type == InternetAddressType.IPv4
? 'ws://${host.address}' ? 'ws://${host.address}'
: 'ws://[${host.address}]'; : 'ws://[${host.address}]';
final String encodedWebsocketUrl = Uri.encodeComponent(websocketUrl); final String encodedWebsocketUrl = Uri.encodeComponent(websocketUrl);
...@@ -796,7 +796,7 @@ class _FlutterPlatform extends PlatformPlugin { ...@@ -796,7 +796,7 @@ class _FlutterPlatform extends PlatformPlugin {
} else { } else {
command.add('--disable-observatory'); command.add('--disable-observatory');
} }
if (host.type == InternetAddressType.IP_V6) // ignore: deprecated_member_use if (host.type == InternetAddressType.IPv6)
command.add('--ipv6'); command.add('--ipv6');
if (bundlePath != null) { if (bundlePath != null) {
command.add('--flutter-assets-dir=$bundlePath'); command.add('--flutter-assets-dir=$bundlePath');
......
...@@ -78,7 +78,7 @@ Future<int> runTests( ...@@ -78,7 +78,7 @@ Future<int> runTests(
throwToolExit('Cannot find Flutter shell at $shellPath'); throwToolExit('Cannot find Flutter shell at $shellPath');
final InternetAddressType serverType = final InternetAddressType serverType =
ipv6 ? InternetAddressType.IP_V6 : InternetAddressType.IP_V4; // ignore: deprecated_member_use ipv6 ? InternetAddressType.IPv6 : InternetAddressType.IPv4;
loader.installHook( loader.installHook(
shellPath: shellPath, shellPath: shellPath,
......
...@@ -534,10 +534,7 @@ class GitTagVersion { ...@@ -534,10 +534,7 @@ class GitTagVersion {
printTrace('Could not interpret results of "git describe": $version'); printTrace('Could not interpret results of "git describe": $version');
return const GitTagVersion.unknown(); return const GitTagVersion.unknown();
} }
final List<int> parsedParts = parts.take(4).map<int>( final List<int> parsedParts = parts.take(4).map<int>(int.tryParse).toList();
// ignore: deprecated_member_use
(String value) => int.parse(value, onError: (String value) => null),
).toList();
return new GitTagVersion(parsedParts[0], parsedParts[1], parsedParts[2], parsedParts[3], parts[4]); return new GitTagVersion(parsedParts[0], parsedParts[1], parsedParts[2], parsedParts[3], parts[4]);
} }
......
...@@ -1402,7 +1402,7 @@ class ServiceMap extends ServiceObject implements Map<String, dynamic> { ...@@ -1402,7 +1402,7 @@ class ServiceMap extends ServiceObject implements Map<String, dynamic> {
Iterable<MapEntry<String, dynamic>> get entries => _map.entries; Iterable<MapEntry<String, dynamic>> get entries => _map.entries;
@override @override
void updateAll(dynamic update(String key, dynamic value)) => _map.updateAll(update); void updateAll(dynamic update(String key, dynamic value)) => _map.updateAll(update);
Map<RK, RV> retype<RK, RV>() => _map.cast<RK, RV>(); // ignore: deprecated_member_use,annotate_overrides Map<RK, RV> retype<RK, RV>() => _map.cast<RK, RV>(); // ignore: annotate_overrides
@override @override
dynamic update(String key, dynamic update(dynamic value), {dynamic ifAbsent()}) => _map.update(key, update, ifAbsent: ifAbsent); dynamic update(String key, dynamic update(dynamic value), {dynamic ifAbsent()}) => _map.update(key, update, ifAbsent: ifAbsent);
} }
......
...@@ -26,7 +26,7 @@ void main() { ...@@ -26,7 +26,7 @@ void main() {
}); });
testUsingContext('toString() works', () async { testUsingContext('toString() works', () async {
expect(io.ProcessSignal.SIGINT.toString(), ProcessSignal.SIGINT.toString()); // ignore: deprecated_member_use expect(io.ProcessSignal.sigint.toString(), ProcessSignal.SIGINT.toString());
}); });
}); });
} }
......
...@@ -124,7 +124,7 @@ class MockFileSystem extends ForwardingFileSystem { ...@@ -124,7 +124,7 @@ class MockFileSystem extends ForwardingFileSystem {
class MockFile extends Mock implements File { class MockFile extends Mock implements File {
@override @override
Future<RandomAccessFile> open({FileMode mode = FileMode.READ}) async { // ignore: deprecated_member_use Future<RandomAccessFile> open({FileMode mode = FileMode.read}) async {
return new MockRandomAccessFile(); return new MockRandomAccessFile();
} }
} }
......
...@@ -563,7 +563,7 @@ class LoggingProcessManager extends LocalProcessManager { ...@@ -563,7 +563,7 @@ class LoggingProcessManager extends LocalProcessManager {
Map<String, String> environment, Map<String, String> environment,
bool includeParentEnvironment = true, bool includeParentEnvironment = true,
bool runInShell = false, bool runInShell = false,
ProcessStartMode mode = ProcessStartMode.NORMAL, // ignore: deprecated_member_use ProcessStartMode mode = ProcessStartMode.normal,
}) { }) {
commands.add(command); commands.add(command);
return super.start( return super.start(
......
...@@ -48,8 +48,8 @@ class MockProcessManager extends Mock implements ProcessManager { ...@@ -48,8 +48,8 @@ class MockProcessManager extends Mock implements ProcessManager {
Map<String, String> environment, Map<String, String> environment,
bool includeParentEnvironment = true, bool includeParentEnvironment = true,
bool runInShell = false, bool runInShell = false,
Encoding stdoutEncoding = SYSTEM_ENCODING, // ignore: deprecated_member_use Encoding stdoutEncoding = systemEncoding,
Encoding stderrEncoding = SYSTEM_ENCODING, // ignore: deprecated_member_use Encoding stderrEncoding = systemEncoding,
}) async { }) async {
return new ProcessResult(0, 0, '', ''); return new ProcessResult(0, 0, '', '');
} }
...@@ -61,8 +61,8 @@ class MockProcessManager extends Mock implements ProcessManager { ...@@ -61,8 +61,8 @@ class MockProcessManager extends Mock implements ProcessManager {
Map<String, String> environment, Map<String, String> environment,
bool includeParentEnvironment = true, bool includeParentEnvironment = true,
bool runInShell = false, bool runInShell = false,
Encoding stdoutEncoding = SYSTEM_ENCODING, // ignore: deprecated_member_use Encoding stdoutEncoding = systemEncoding,
Encoding stderrEncoding = SYSTEM_ENCODING, // ignore: deprecated_member_use Encoding stderrEncoding = systemEncoding,
}) { }) {
return new ProcessResult(0, 0, '', ''); return new ProcessResult(0, 0, '', '');
} }
......
...@@ -38,8 +38,8 @@ class MockProcessManager extends Mock implements ProcessManager { ...@@ -38,8 +38,8 @@ class MockProcessManager extends Mock implements ProcessManager {
Map<String, String> environment, Map<String, String> environment,
bool includeParentEnvironment = true, bool includeParentEnvironment = true,
bool runInShell = false, bool runInShell = false,
Encoding stdoutEncoding = SYSTEM_ENCODING, // ignore: deprecated_member_use Encoding stdoutEncoding = systemEncoding,
Encoding stderrEncoding = SYSTEM_ENCODING, // ignore: deprecated_member_use Encoding stderrEncoding = systemEncoding,
}) async { }) async {
return new ProcessResult(0, 0, '1234\n5678\n5', ''); return new ProcessResult(0, 0, '1234\n5678\n5', '');
} }
......
...@@ -164,7 +164,7 @@ class MockProcessManager implements ProcessManager { ...@@ -164,7 +164,7 @@ class MockProcessManager implements ProcessManager {
Map<String, String> environment, Map<String, String> environment,
bool includeParentEnvironment = true, bool includeParentEnvironment = true,
bool runInShell = false, bool runInShell = false,
ProcessStartMode mode = ProcessStartMode.NORMAL, // ignore: deprecated_member_use ProcessStartMode mode = ProcessStartMode.normal,
}) { }) {
lastPubEnvironment = environment['PUB_ENVIRONMENT']; lastPubEnvironment = environment['PUB_ENVIRONMENT'];
lastPubCache = environment['PUB_CACHE']; lastPubCache = environment['PUB_CACHE'];
...@@ -237,7 +237,7 @@ class MockFileSystem extends ForwardingFileSystem { ...@@ -237,7 +237,7 @@ class MockFileSystem extends ForwardingFileSystem {
class MockFile implements File { class MockFile implements File {
@override @override
Future<RandomAccessFile> open({FileMode mode = FileMode.READ}) async { // ignore: deprecated_member_use Future<RandomAccessFile> open({FileMode mode = FileMode.read}) async {
return new MockRandomAccessFile(); return new MockRandomAccessFile();
} }
......
...@@ -388,11 +388,11 @@ class MockVMService extends BasicMock implements VMService { ...@@ -388,11 +388,11 @@ class MockVMService extends BasicMock implements VMService {
Future<Null> setUp() async { Future<Null> setUp() async {
try { try {
_server = await HttpServer.bind(InternetAddress.LOOPBACK_IP_V6, 0); // ignore: deprecated_member_use _server = await HttpServer.bind(InternetAddress.loopbackIPv6, 0);
_httpAddress = Uri.parse('http://[::1]:${_server.port}'); _httpAddress = Uri.parse('http://[::1]:${_server.port}');
} on SocketException { } on SocketException {
// Fall back to IPv4 if the host doesn't support binding to IPv6 localhost // Fall back to IPv4 if the host doesn't support binding to IPv6 localhost
_server = await HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 0); // ignore: deprecated_member_use _server = await HttpServer.bind(InternetAddress.loopbackIPv4, 0);
_httpAddress = Uri.parse('http://127.0.0.1:${_server.port}'); _httpAddress = Uri.parse('http://127.0.0.1:${_server.port}');
} }
_server.listen((HttpRequest request) { _server.listen((HttpRequest request) {
......
...@@ -122,7 +122,7 @@ class MockProcessManager implements ProcessManager { ...@@ -122,7 +122,7 @@ class MockProcessManager implements ProcessManager {
Map<String, String> environment, Map<String, String> environment,
bool includeParentEnvironment = true, bool includeParentEnvironment = true,
bool runInShell = false, bool runInShell = false,
ProcessStartMode mode = ProcessStartMode.NORMAL, // ignore: deprecated_member_use ProcessStartMode mode = ProcessStartMode.normal,
}) { }) {
if (!succeed) { if (!succeed) {
final String executable = command[0]; final String executable = command[0];
......
...@@ -477,8 +477,8 @@ class FuchsiaRemoteConnection { ...@@ -477,8 +477,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 != '..')) {
// ignore: deprecated_member_use
final int value = int.parse(lastWord, onError: (_) => null); final int value = int.tryParse(lastWord);
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