add missing type parameter on methods (#22096)
This commit is contained in:
committed by
GitHub
parent
48fb726b01
commit
f62afdcf57
@@ -129,7 +129,7 @@ class AndroidDeviceDiscovery implements DeviceDiscovery {
|
||||
@override
|
||||
Future<Null> chooseWorkingDevice() async {
|
||||
final List<Device> allDevices = (await discoverDevices())
|
||||
.map((String id) => AndroidDevice(deviceId: id))
|
||||
.map<Device>((String id) => AndroidDevice(deviceId: id))
|
||||
.toList();
|
||||
|
||||
if (allDevices.isEmpty)
|
||||
@@ -298,19 +298,19 @@ class AndroidDevice implements Device {
|
||||
await adb(<String>['logcat', '--clear']);
|
||||
final Process process = await startProcess(adbPath, <String>['-s', deviceId, 'logcat']);
|
||||
process.stdout
|
||||
.transform(utf8.decoder)
|
||||
.transform(const LineSplitter())
|
||||
.transform<String>(utf8.decoder)
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen((String line) {
|
||||
print('adb logcat: $line');
|
||||
stream.sink.add(line);
|
||||
}, onDone: () { stdoutDone.complete(); });
|
||||
process.stderr
|
||||
.transform(utf8.decoder)
|
||||
.transform(const LineSplitter())
|
||||
.transform<String>(utf8.decoder)
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen((String line) {
|
||||
print('adb logcat stderr: $line');
|
||||
}, onDone: () { stderrDone.complete(); });
|
||||
process.exitCode.then((int exitCode) {
|
||||
process.exitCode.then<void>((int exitCode) {
|
||||
print('adb logcat process terminated with exit code $exitCode');
|
||||
if (!aborted) {
|
||||
stream.addError(BuildFailedError('adb logcat failed with exit code $exitCode.'));
|
||||
@@ -374,7 +374,7 @@ class IosDeviceDiscovery implements DeviceDiscovery {
|
||||
@override
|
||||
Future<Null> chooseWorkingDevice() async {
|
||||
final List<IosDevice> allDevices = (await discoverDevices())
|
||||
.map((String id) => IosDevice(deviceId: id))
|
||||
.map<IosDevice>((String id) => IosDevice(deviceId: id))
|
||||
.toList();
|
||||
|
||||
if (allDevices.isEmpty)
|
||||
@@ -387,7 +387,7 @@ class IosDeviceDiscovery implements DeviceDiscovery {
|
||||
@override
|
||||
Future<List<String>> discoverDevices() async {
|
||||
final List<String> iosDeviceIDs = LineSplitter.split(await eval('idevice_id', <String>['-l']))
|
||||
.map((String line) => line.trim())
|
||||
.map<String>((String line) => line.trim())
|
||||
.where((String line) => line.isNotEmpty)
|
||||
.toList();
|
||||
if (iosDeviceIDs.isEmpty)
|
||||
|
||||
@@ -83,7 +83,7 @@ Manifest _validateAndParseManifest(Map<dynamic, dynamic> manifestYaml) {
|
||||
List<ManifestTask> _validateAndParseTasks(dynamic tasksYaml) {
|
||||
_checkType(tasksYaml is Map, tasksYaml, 'Value of "tasks"', 'dictionary');
|
||||
final List<dynamic> sortedKeys = tasksYaml.keys.toList()..sort();
|
||||
return sortedKeys.map((dynamic taskName) => _validateAndParseTask(taskName, tasksYaml[taskName])).toList();
|
||||
return sortedKeys.map<ManifestTask>((dynamic taskName) => _validateAndParseTask(taskName, tasksYaml[taskName])).toList();
|
||||
}
|
||||
|
||||
ManifestTask _validateAndParseTask(dynamic taskName, dynamic taskYaml) {
|
||||
|
||||
@@ -44,8 +44,8 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent = false }) a
|
||||
final Completer<int> port = Completer<int>();
|
||||
|
||||
final StreamSubscription<String> stdoutSub = runner.stdout
|
||||
.transform(const Utf8Decoder())
|
||||
.transform(const LineSplitter())
|
||||
.transform<String>(const Utf8Decoder())
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen((String line) {
|
||||
if (!port.isCompleted) {
|
||||
final int portValue = parseServicePort(line, prefix: 'Observatory listening on ');
|
||||
@@ -58,8 +58,8 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent = false }) a
|
||||
});
|
||||
|
||||
final StreamSubscription<String> stderrSub = runner.stderr
|
||||
.transform(const Utf8Decoder())
|
||||
.transform(const LineSplitter())
|
||||
.transform<String>(const Utf8Decoder())
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen((String line) {
|
||||
stderr.writeln('[$taskName] [STDERR] $line');
|
||||
});
|
||||
|
||||
@@ -172,14 +172,14 @@ Future<String> getCurrentFlutterRepoCommit() {
|
||||
return null;
|
||||
}
|
||||
|
||||
return inDirectory(flutterDirectory, () {
|
||||
return inDirectory<String>(flutterDirectory, () {
|
||||
return eval('git', <String>['rev-parse', 'HEAD']);
|
||||
});
|
||||
}
|
||||
|
||||
Future<DateTime> getFlutterRepoCommitTimestamp(String commit) {
|
||||
// git show -s --format=%at 4b546df7f0b3858aaaa56c4079e5be1ba91fbb65
|
||||
return inDirectory(flutterDirectory, () async {
|
||||
return inDirectory<DateTime>(flutterDirectory, () async {
|
||||
final String unixTimestamp = await eval('git', <String>[
|
||||
'show',
|
||||
'-s',
|
||||
@@ -235,7 +235,7 @@ Future<Process> startProcess(
|
||||
final ProcessInfo processInfo = ProcessInfo(command, process);
|
||||
_runningProcesses.add(processInfo);
|
||||
|
||||
process.exitCode.then((int exitCode) {
|
||||
process.exitCode.then<void>((int exitCode) {
|
||||
print('"$executable" exit code: $exitCode');
|
||||
_runningProcesses.remove(processInfo);
|
||||
});
|
||||
@@ -273,14 +273,14 @@ Future<int> exec(
|
||||
final Completer<Null> stdoutDone = Completer<Null>();
|
||||
final Completer<Null> stderrDone = Completer<Null>();
|
||||
process.stdout
|
||||
.transform(utf8.decoder)
|
||||
.transform(const LineSplitter())
|
||||
.transform<String>(utf8.decoder)
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen((String line) {
|
||||
print('stdout: $line');
|
||||
}, onDone: () { stdoutDone.complete(); });
|
||||
process.stderr
|
||||
.transform(utf8.decoder)
|
||||
.transform(const LineSplitter())
|
||||
.transform<String>(utf8.decoder)
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen((String line) {
|
||||
print('stderr: $line');
|
||||
}, onDone: () { stderrDone.complete(); });
|
||||
@@ -310,15 +310,15 @@ Future<String> eval(
|
||||
final Completer<Null> stdoutDone = Completer<Null>();
|
||||
final Completer<Null> stderrDone = Completer<Null>();
|
||||
process.stdout
|
||||
.transform(utf8.decoder)
|
||||
.transform(const LineSplitter())
|
||||
.transform<String>(utf8.decoder)
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen((String line) {
|
||||
print('stdout: $line');
|
||||
output.writeln(line);
|
||||
}, onDone: () { stdoutDone.complete(); });
|
||||
process.stderr
|
||||
.transform(utf8.decoder)
|
||||
.transform(const LineSplitter())
|
||||
.transform<String>(utf8.decoder)
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen((String line) {
|
||||
print('stderr: $line');
|
||||
}, onDone: () { stderrDone.complete(); });
|
||||
@@ -427,11 +427,11 @@ Future<Null> getFlutter(String revision) async {
|
||||
flutterDirectory.deleteSync(recursive: true);
|
||||
}
|
||||
|
||||
await inDirectory(flutterDirectory.parent, () async {
|
||||
await inDirectory<void>(flutterDirectory.parent, () async {
|
||||
await exec('git', <String>['clone', 'https://github.com/flutter/flutter.git']);
|
||||
});
|
||||
|
||||
await inDirectory(flutterDirectory, () async {
|
||||
await inDirectory<void>(flutterDirectory, () async {
|
||||
await exec('git', <String>['checkout', revision]);
|
||||
});
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ const int _kRunsPerBenchmark = 3;
|
||||
Directory get _megaGalleryDirectory => dir(path.join(Directory.systemTemp.path, 'mega_gallery'));
|
||||
|
||||
Future<TaskResult> analyzerBenchmarkTask() async {
|
||||
await inDirectory(flutterDirectory, () async {
|
||||
await inDirectory<void>(flutterDirectory, () async {
|
||||
rmTree(_megaGalleryDirectory);
|
||||
mkdirs(_megaGalleryDirectory);
|
||||
await dart(<String>['dev/tools/mega_gallery.dart', '--out=${_megaGalleryDirectory.path}']);
|
||||
@@ -74,7 +74,7 @@ abstract class _Benchmark {
|
||||
Future<double> execute(int iteration, int targetIterations) async {
|
||||
section('Analyze $title ${watch ? 'with watcher' : ''} - ${iteration + 1} / $targetIterations');
|
||||
final Stopwatch stopwatch = Stopwatch();
|
||||
await inDirectory(directory, () async {
|
||||
await inDirectory<void>(directory, () async {
|
||||
stopwatch.start();
|
||||
await flutter('analyze', options: options);
|
||||
stopwatch.stop();
|
||||
|
||||
@@ -28,7 +28,7 @@ class GalleryTransitionTest {
|
||||
final String deviceId = device.deviceId;
|
||||
final Directory galleryDirectory =
|
||||
dir('${flutterDirectory.path}/examples/flutter_gallery');
|
||||
await inDirectory(galleryDirectory, () async {
|
||||
await inDirectory<void>(galleryDirectory, () async {
|
||||
await flutter('packages', options: <String>['get']);
|
||||
|
||||
if (deviceOperatingSystem == DeviceOperatingSystem.ios)
|
||||
|
||||
@@ -29,11 +29,11 @@ TaskFunction createHotModeTest() {
|
||||
int hotReloadCount = 0;
|
||||
Map<String, dynamic> twoReloadsData;
|
||||
Map<String, dynamic> freshRestartReloadsData;
|
||||
await inDirectory(flutterDirectory, () async {
|
||||
await inDirectory<void>(flutterDirectory, () async {
|
||||
rmTree(_editedFlutterGalleryDir);
|
||||
mkdirs(_editedFlutterGalleryDir);
|
||||
recursiveCopy(flutterGalleryDir, _editedFlutterGalleryDir);
|
||||
await inDirectory(_editedFlutterGalleryDir, () async {
|
||||
await inDirectory<void>(_editedFlutterGalleryDir, () async {
|
||||
if (deviceOperatingSystem == DeviceOperatingSystem.ios)
|
||||
await prepareProvisioningCertificates(_editedFlutterGalleryDir.path);
|
||||
{
|
||||
@@ -46,8 +46,8 @@ TaskFunction createHotModeTest() {
|
||||
final Completer<Null> stdoutDone = Completer<Null>();
|
||||
final Completer<Null> stderrDone = Completer<Null>();
|
||||
process.stdout
|
||||
.transform(utf8.decoder)
|
||||
.transform(const LineSplitter())
|
||||
.transform<String>(utf8.decoder)
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen((String line) {
|
||||
if (line.contains('\] Reloaded ')) {
|
||||
if (hotReloadCount == 0) {
|
||||
@@ -72,8 +72,8 @@ TaskFunction createHotModeTest() {
|
||||
stdoutDone.complete();
|
||||
});
|
||||
process.stderr
|
||||
.transform(utf8.decoder)
|
||||
.transform(const LineSplitter())
|
||||
.transform<String>(utf8.decoder)
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen((String line) {
|
||||
print('stderr: $line');
|
||||
}, onDone: () {
|
||||
@@ -99,8 +99,8 @@ TaskFunction createHotModeTest() {
|
||||
final Completer<Null> stdoutDone = Completer<Null>();
|
||||
final Completer<Null> stderrDone = Completer<Null>();
|
||||
process.stdout
|
||||
.transform(utf8.decoder)
|
||||
.transform(const LineSplitter())
|
||||
.transform<String>(utf8.decoder)
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen((String line) {
|
||||
if (line.contains('\] Reloaded ')) {
|
||||
process.stdin.writeln('q');
|
||||
@@ -110,8 +110,8 @@ TaskFunction createHotModeTest() {
|
||||
stdoutDone.complete();
|
||||
});
|
||||
process.stderr
|
||||
.transform(utf8.decoder)
|
||||
.transform(const LineSplitter())
|
||||
.transform<String>(utf8.decoder)
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen((String line) {
|
||||
print('stderr: $line');
|
||||
}, onDone: () {
|
||||
|
||||
@@ -73,7 +73,7 @@ class DriverTest {
|
||||
final List<String> extraOptions;
|
||||
|
||||
Future<TaskResult> call() {
|
||||
return inDirectory(testDirectory, () async {
|
||||
return inDirectory<TaskResult>(testDirectory, () async {
|
||||
final Device device = await devices.workingDevice;
|
||||
await device.unlock();
|
||||
final String deviceId = device.deviceId;
|
||||
|
||||
@@ -15,7 +15,7 @@ Future<TaskResult> runEndToEndTests() async {
|
||||
await device.unlock();
|
||||
final String deviceId = device.deviceId;
|
||||
final Directory testDirectory = dir('${flutterDirectory.path}/dev/integration_tests/ui');
|
||||
await inDirectory(testDirectory, () async {
|
||||
await inDirectory<void>(testDirectory, () async {
|
||||
await flutter('packages', options: <String>['get']);
|
||||
|
||||
if (deviceOperatingSystem == DeviceOperatingSystem.ios)
|
||||
|
||||
@@ -78,8 +78,8 @@ Future<Map<String, double>> _readJsonResults(Process process) {
|
||||
final Completer<Map<String, double>> completer = Completer<Map<String, double>>();
|
||||
|
||||
final StreamSubscription<String> stderrSub = process.stderr
|
||||
.transform(const Utf8Decoder())
|
||||
.transform(const LineSplitter())
|
||||
.transform<String>(const Utf8Decoder())
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen((String line) {
|
||||
stderr.writeln('[STDERR] $line');
|
||||
});
|
||||
@@ -87,8 +87,8 @@ Future<Map<String, double>> _readJsonResults(Process process) {
|
||||
bool processWasKilledIntentionally = false;
|
||||
bool resultsHaveBeenParsed = false;
|
||||
final StreamSubscription<String> stdoutSub = process.stdout
|
||||
.transform(const Utf8Decoder())
|
||||
.transform(const LineSplitter())
|
||||
.transform<String>(const Utf8Decoder())
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen((String line) async {
|
||||
print(line);
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ TaskFunction createBasicMaterialCompileTest() {
|
||||
|
||||
rmTree(sampleDir);
|
||||
|
||||
await inDirectory(Directory.systemTemp, () async {
|
||||
await inDirectory<void>(Directory.systemTemp, () async {
|
||||
await flutter('create', options: <String>[sampleAppName]);
|
||||
});
|
||||
|
||||
@@ -95,7 +95,7 @@ class StartupTest {
|
||||
final bool reportMetrics;
|
||||
|
||||
Future<TaskResult> run() async {
|
||||
return await inDirectory(testDirectory, () async {
|
||||
return await inDirectory<TaskResult>(testDirectory, () async {
|
||||
final String deviceId = (await devices.workingDevice).deviceId;
|
||||
await flutter('packages', options: <String>['get']);
|
||||
|
||||
@@ -131,7 +131,7 @@ class PerfTest {
|
||||
final String timelineFileName;
|
||||
|
||||
Future<TaskResult> run() {
|
||||
return inDirectory(testDirectory, () async {
|
||||
return inDirectory<TaskResult>(testDirectory, () async {
|
||||
final Device device = await devices.workingDevice;
|
||||
await device.unlock();
|
||||
final String deviceId = device.deviceId;
|
||||
@@ -183,7 +183,7 @@ class CompileTest {
|
||||
final bool reportPackageContentSizes;
|
||||
|
||||
Future<TaskResult> run() async {
|
||||
return await inDirectory(testDirectory, () async {
|
||||
return await inDirectory<TaskResult>(testDirectory, () async {
|
||||
final Device device = await devices.workingDevice;
|
||||
await device.unlock();
|
||||
await flutter('packages', options: <String>['get']);
|
||||
@@ -402,7 +402,7 @@ class MemoryTest {
|
||||
Device _device;
|
||||
|
||||
Future<TaskResult> run() {
|
||||
return inDirectory(project, () async {
|
||||
return inDirectory<TaskResult>(project, () async {
|
||||
// This test currently only works on Android, because device.logcat,
|
||||
// device.getMemoryStats, etc, aren't implemented for iOS.
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ Future<TaskResult> samplePageCatalogGenerator(String authorizationToken) async {
|
||||
final String deviceId = device.deviceId;
|
||||
|
||||
final Directory catalogDirectory = dir('${flutterDirectory.path}/examples/catalog');
|
||||
await inDirectory(catalogDirectory, () async {
|
||||
await inDirectory<void>(catalogDirectory, () async {
|
||||
await flutter('packages', options: <String>['get']);
|
||||
|
||||
final bool isIosDevice = deviceOperatingSystem == DeviceOperatingSystem.ios;
|
||||
|
||||
@@ -65,7 +65,7 @@ class Upload {
|
||||
} else {
|
||||
// TODO(hansmuller): only retry on 5xx and 429 responses
|
||||
logMessage('Request to save "$name" (length ${content.length}) failed with status ${response.statusCode}, will retry');
|
||||
logMessage(await response.transform(utf8.decoder).join());
|
||||
logMessage(await response.transform<String>(utf8.decoder).join());
|
||||
}
|
||||
return response.statusCode == HttpStatus.ok;
|
||||
} on TimeoutException catch (_) {
|
||||
@@ -104,7 +104,7 @@ Future<Null> saveScreenshots(List<String> fromPaths, List<String> largeNames, Li
|
||||
while (uploads.any(Upload.isNotComplete)) {
|
||||
final HttpClient client = HttpClient();
|
||||
uploads = uploads.where(Upload.isNotComplete).toList();
|
||||
await Future.wait(uploads.map((Upload upload) => upload.run(client)));
|
||||
await Future.wait<bool>(uploads.map<Future<bool>>((Upload upload) => upload.run(client)));
|
||||
client.close(force: true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user