add missing type parameter on methods (#22096)

This commit is contained in:
Alexandre Ardhuin
2018-10-01 21:29:08 +02:00
committed by GitHub
parent 48fb726b01
commit f62afdcf57
211 changed files with 504 additions and 503 deletions

View File

@@ -494,7 +494,7 @@ class ItemGalleryBox extends StatelessWidget {
children: <Widget>[
Expanded(
child: TabBarView(
children: tabNames.map((String tabName) {
children: tabNames.map<Widget>((String tabName) {
return Container(
key: PageStorageKey<String>(tabName),
child: Padding(

View File

@@ -207,8 +207,8 @@ Future<EvalResult> _evalCommand(String executable, List<String> arguments, {
final Future<List<List<int>>> savedStderr = process.stderr.toList();
final int exitCode = await process.exitCode;
final EvalResult result = EvalResult(
stdout: utf8.decode((await savedStdout).expand((List<int> ints) => ints).toList()),
stderr: utf8.decode((await savedStderr).expand((List<int> ints) => ints).toList()),
stdout: utf8.decode((await savedStdout).expand<int>((List<int> ints) => ints).toList()),
stderr: utf8.decode((await savedStderr).expand<int>((List<int> ints) => ints).toList()),
exitCode: exitCode,
);
@@ -328,13 +328,13 @@ Future<Null> _verifyNoBadImportsInFlutter(String workingDirectory) async {
.whereType<Directory>()
.map<String>((Directory entity) => path.basename(entity.path))
.toList()..sort();
if (!_matches(packages, directories)) {
if (!_matches<String>(packages, directories)) {
errors.add(
'flutter/lib/*.dart does not match flutter/lib/src/*/:\n'
'These are the exported packages:\n' +
packages.map((String path) => ' lib/$path.dart').join('\n') +
packages.map<String>((String path) => ' lib/$path.dart').join('\n') +
'These are the directories:\n' +
directories.map((String path) => ' lib/src/$path/').join('\n')
directories.map<String>((String path) => ' lib/src/$path/').join('\n')
);
}
// Verify that the imports are well-ordered.
@@ -350,7 +350,7 @@ Future<Null> _verifyNoBadImportsInFlutter(String workingDirectory) async {
}
}
for (String package in dependencyMap.keys) {
final List<String> loop = _deepSearch(dependencyMap, package);
final List<String> loop = _deepSearch<String>(dependencyMap, package);
if (loop != null) {
errors.add(
'${yellow}Dependency loop:$reset ' +
@@ -421,7 +421,7 @@ List<T> _deepSearch<T>(Map<T, Set<T>> map, T start, [ Set<T> seen ]) {
continue; // we catch these separately
if (seen != null && seen.contains(key))
return <T>[start, key];
final List<T> result = _deepSearch(
final List<T> result = _deepSearch<T>(
map,
key,
(seen == null ? Set<T>.from(<T>[start]) : Set<T>.from(seen))..add(key),

View File

@@ -587,7 +587,7 @@ Future<Null> main(List<String> argList) async {
argParser.addOption(
'branch',
defaultsTo: null,
allowed: Branch.values.map((Branch branch) => getBranchName(branch)),
allowed: Branch.values.map<String>((Branch branch) => getBranchName(branch)),
help: 'The Flutter branch to build the archive with. Required.',
);
argParser.addOption(

View File

@@ -56,7 +56,7 @@ Future<Null> runCommand(String executable, List<String> arguments, {
Future<List<List<int>>> savedStdout, savedStderr;
if (printOutput) {
await Future.wait(<Future<void>>[
await Future.wait<void>(<Future<void>>[
stdout.addStream(process.stdout),
stderr.addStream(process.stderr)
]);
@@ -75,8 +75,8 @@ Future<Null> runCommand(String executable, List<String> arguments, {
print(failureMessage);
}
if (!printOutput) {
stdout.writeln(utf8.decode((await savedStdout).expand((List<int> ints) => ints).toList()));
stderr.writeln(utf8.decode((await savedStderr).expand((List<int> ints) => ints).toList()));
stdout.writeln(utf8.decode((await savedStdout).expand<int>((List<int> ints) => ints).toList()));
stderr.writeln(utf8.decode((await savedStderr).expand<int>((List<int> ints) => ints).toList()));
}
print(
'$redLine\n'

View File

@@ -13,8 +13,8 @@ void main() {
'../../bin/cache/dart-sdk/bin/dart',
<String>['analyze-sample-code.dart', 'test/analyze-sample-code-test-input'],
);
final List<String> stdout = await process.stdout.transform(utf8.decoder).transform(const LineSplitter()).toList();
final List<String> stderr = await process.stderr.transform(utf8.decoder).transform(const LineSplitter()).toList();
final List<String> stdout = await process.stdout.transform<String>(utf8.decoder).transform<String>(const LineSplitter()).toList();
final List<String> stderr = await process.stderr.transform<String>(utf8.decoder).transform<String>(const LineSplitter()).toList();
final Match line = RegExp(r'^(.+)/main\.dart:[0-9]+:[0-9]+: .+$').matchAsPrefix(stdout[1]);
expect(line, isNot(isNull));
final String directory = line.group(1);

View File

@@ -30,8 +30,8 @@ void main() {
);
final StreamController<String> stdout = StreamController<String>.broadcast();
run.stdout
.transform(utf8.decoder)
.transform(const LineSplitter())
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
print('run:stdout: $line');
stdout.add(line);
@@ -46,12 +46,12 @@ void main() {
}
});
run.stderr
.transform(utf8.decoder)
.transform(const LineSplitter())
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
stderr.writeln('run:stderr: $line');
});
run.exitCode.then((int exitCode) { ok = false; });
run.exitCode.then<void>((int exitCode) { ok = false; });
await Future.any<dynamic>(<Future<dynamic>>[ ready.future, run.exitCode ]);
if (!ok)
throw 'Failed to run test app.';
@@ -114,14 +114,14 @@ class DriveHelper {
<String>['drive', '--use-existing-app', 'http://127.0.0.1:$vmServicePort/', '--keep-app-running', '--driver', 'test_driver/commands_${name}_test.dart'],
);
drive.stdout
.transform(utf8.decoder)
.transform(const LineSplitter())
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
print('drive:stdout: $line');
});
drive.stderr
.transform(utf8.decoder)
.transform(const LineSplitter())
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
stderr.writeln('drive:stderr: $line');
});

View File

@@ -21,7 +21,7 @@ Future<Null> main() async {
int publicMembers = 0;
int otherErrors = 0;
int otherLines = 0;
await for (String entry in analysis.stdout.transform(utf8.decoder).transform(const LineSplitter())) {
await for (String entry in analysis.stdout.transform<String>(utf8.decoder).transform<String>(const LineSplitter())) {
entry = entry.trim();
print('analyzer stdout: $entry');
if (entry == 'Building flutter tool...') {
@@ -36,7 +36,7 @@ Future<Null> main() async {
otherLines += 1;
}
}
await for (String entry in analysis.stderr.transform(utf8.decoder).transform(const LineSplitter())) {
await for (String entry in analysis.stderr.transform<String>(utf8.decoder).transform<String>(const LineSplitter())) {
print('analyzer stderr: $entry');
if (entry.startsWith('[lint] ')) {
// ignore this line

View File

@@ -26,8 +26,8 @@ Future<void> testReload(Process process, { Future<void> Function() onListening }
int exitCode;
process.stdout
.transform(utf8.decoder)
.transform(const LineSplitter())
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
print('attach:stdout: $line');
stdout.add(line);
@@ -43,14 +43,14 @@ Future<void> testReload(Process process, { Future<void> Function() onListening }
finished.complete();
});
process.stderr
.transform(utf8.decoder)
.transform(const LineSplitter())
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
print('run:stderr: $line');
stdout.add(line);
});
process.exitCode.then((int processExitCode) { exitCode = processExitCode; });
process.exitCode.then<void>((int processExitCode) { exitCode = processExitCode; });
Future<dynamic> eventOrExit(Future<Null> event) {
return Future.any<dynamic>(<Future<dynamic>>[ event, process.exitCode ]);

View File

@@ -45,7 +45,7 @@ Future<int> runTest() async {
);
int badLines = 0;
TestStep step = TestStep.starting;
await for (String entry in analysis.stdout.transform(utf8.decoder).transform(const LineSplitter())) {
await for (String entry in analysis.stdout.transform<String>(utf8.decoder).transform<String>(const LineSplitter())) {
print('test stdout ($step): $entry');
if (step == TestStep.starting && entry == 'Building flutter tool...') {
// ignore this line
@@ -76,7 +76,7 @@ Future<int> runTest() async {
}
}
}
await for (String entry in analysis.stderr.transform(utf8.decoder).transform(const LineSplitter())) {
await for (String entry in analysis.stderr.transform<String>(utf8.decoder).transform<String>(const LineSplitter())) {
print('test stderr: $entry');
badLines += 1;
}

View File

@@ -297,7 +297,7 @@ class _Dependencies {
.replaceAllMapped(_separatorExpr, (Match match) => '${match.group(1)}\n')
.split('\n')
// Expand escape sequences, so that '\ ', for example,ß becomes ' '
.map((String path) => path.replaceAllMapped(_escapeExpr, (Match match) => match.group(1)).trim())
.map<String>((String path) => path.replaceAllMapped(_escapeExpr, (Match match) => match.group(1)).trim())
.where((String path) => path.isNotEmpty)
.toSet();
}

View File

@@ -37,8 +37,8 @@ void main() {
<String>['run', '--verbose', '-d', device.deviceId, '--route', '/smuggle-it', 'lib/route.dart'],
);
run.stdout
.transform(utf8.decoder)
.transform(const LineSplitter())
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
print('run:stdout: $line');
if (vmServicePort == null) {
@@ -52,12 +52,12 @@ void main() {
}
});
run.stderr
.transform(utf8.decoder)
.transform(const LineSplitter())
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
stderr.writeln('run:stderr: $line');
});
run.exitCode.then((int exitCode) { ok = false; });
run.exitCode.then<void>((int exitCode) { ok = false; });
await Future.any<dynamic>(<Future<dynamic>>[ ready.future, run.exitCode ]);
if (!ok)
throw 'Failed to run test app.';
@@ -67,14 +67,14 @@ void main() {
<String>['drive', '--use-existing-app', 'http://127.0.0.1:$vmServicePort/', '--no-keep-app-running', 'lib/route.dart'],
);
drive.stdout
.transform(utf8.decoder)
.transform(const LineSplitter())
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
print('drive:stdout: $line');
});
drive.stderr
.transform(utf8.decoder)
.transform(const LineSplitter())
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
stderr.writeln('drive:stderr: $line');
});

View File

@@ -27,7 +27,7 @@ void main() {
}
Stream<String> transformToLines(Stream<List<int>> byteStream) {
return byteStream.transform(utf8.decoder).transform(const LineSplitter());
return byteStream.transform<String>(utf8.decoder).transform<String>(const LineSplitter());
}
task(() async {
@@ -74,7 +74,7 @@ void main() {
transformToLines(run.stderr).listen((String line) {
stderr.writeln('run:stderr: $line');
});
run.exitCode.then((int exitCode) {
run.exitCode.then<void>((int exitCode) {
ok = false;
});
await Future.any<dynamic>(<Future<dynamic>>[ready.future, run.exitCode]);

View File

@@ -29,8 +29,8 @@ void main() {
final List<String> stderr = <String>[];
int runExitCode;
run.stdout
.transform(utf8.decoder)
.transform(const LineSplitter())
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
print('run:stdout: $line');
stdout.add(line);
@@ -38,13 +38,13 @@ void main() {
ready.complete();
});
run.stderr
.transform(utf8.decoder)
.transform(const LineSplitter())
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
print('run:stderr: $line');
stdout.add(line);
});
run.exitCode.then((int exitCode) { runExitCode = exitCode; });
run.exitCode.then<void>((int exitCode) { runExitCode = exitCode; });
await Future.any<dynamic>(<Future<dynamic>>[ ready.future, run.exitCode ]);
if (runExitCode != null)
throw 'Failed to run test app; runner unexpected exited, with exit code $runExitCode.';

View File

@@ -29,8 +29,8 @@ void main() {
<String>['run', '--verbose', '-d', device.deviceId, 'lib/main.dart'],
);
run.stdout
.transform(utf8.decoder)
.transform(const LineSplitter())
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
print('run:stdout: $line');
if (vmServicePort == null) {
@@ -44,12 +44,12 @@ void main() {
}
});
run.stderr
.transform(utf8.decoder)
.transform(const LineSplitter())
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
stderr.writeln('run:stderr: $line');
});
run.exitCode.then((int exitCode) { ok = false; });
run.exitCode.then<void>((int exitCode) { ok = false; });
await Future.any<dynamic>(<Future<dynamic>>[ ready.future, run.exitCode ]);
if (!ok)
throw 'Failed to run test app.';

View File

@@ -54,7 +54,7 @@ Future<double> findCostsForRepo() async {
workingDirectory: flutterDirectory.path,
);
double total = 0.0;
await for (String entry in git.stdout.transform(utf8.decoder).transform(const LineSplitter()))
await for (String entry in git.stdout.transform<String>(utf8.decoder).transform<String>(const LineSplitter()))
total += await findCostsForFile(File(path.join(flutterDirectory.path, entry)));
final int gitExitCode = await git.exitCode;
if (gitExitCode != 0)

View File

@@ -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)

View File

@@ -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) {

View File

@@ -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');
});

View File

@@ -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]);
});

View File

@@ -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();

View File

@@ -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)

View File

@@ -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: () {

View File

@@ -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;

View File

@@ -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)

View File

@@ -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);

View File

@@ -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.

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -59,7 +59,7 @@ class TestApp extends StatelessWidget {
builder: (BuildContext context) {
return Scaffold(
body: ListView(
children: routes.map((String value) {
children: routes.map<Widget>((String value) {
return MaterialButton(
child: Text(value),
onPressed: () {

View File

@@ -123,7 +123,7 @@ class PlatformViewState extends State<PlatformViewPage> {
final List<dynamic> unTypedRecordedEvents = codec.decodeMessage(data);
final List<Map<String, dynamic>> recordedEvents = unTypedRecordedEvents
.cast<Map<dynamic, dynamic>>()
.map((Map<dynamic, dynamic> e) =>e.cast<String, dynamic>())
.map<Map<String, dynamic>>((Map<dynamic, dynamic> e) =>e.cast<String, dynamic>())
.toList();
await channel.invokeMethod('pipeFlutterViewEvents');
await viewChannel.invokeMethod('pipeTouchEvents');

View File

@@ -22,7 +22,7 @@ class IconsList extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListView(
children: samples.map((IconSample s) => IconSampleRow(s)).toList(),
children: samples.map<IconSampleRow>((IconSample s) => IconSampleRow(s)).toList(),
);
}
}

View File

@@ -452,7 +452,7 @@ class _AnimationDemoState extends State<AnimationDemo> with TickerProviderStateM
appBar: AppBar(
title: const Text('Animation'),
bottom: TabBar(
tabs: _allDemos.map((_ArcDemo demo) => Tab(text: demo.title)).toList(),
tabs: _allDemos.map<Tab>((_ArcDemo demo) => Tab(text: demo.title)).toList(),
),
),
floatingActionButton: Builder(
@@ -466,7 +466,7 @@ class _AnimationDemoState extends State<AnimationDemo> with TickerProviderStateM
},
),
body: TabBarView(
children: _allDemos.map((_ArcDemo demo) => demo.builder(demo)).toList()
children: _allDemos.map<Widget>((_ArcDemo demo) => demo.builder(demo)).toList()
)
)
);

View File

@@ -119,7 +119,7 @@ class PageViewAppState extends State<PageViewApp> {
Widget _buildBody(BuildContext context) {
return PageView(
children: cardModels.map(buildCard).toList(),
children: cardModels.map<Widget>(buildCard).toList(),
// TODO(abarth): itemsWrap: itemsWrap,
scrollDirection: scrollDirection,
);

View File

@@ -189,7 +189,7 @@ class _FuzzerState extends State<Fuzzer> with SingleTickerProviderStateMixin {
switch (_random.nextInt(10)) {
case 0:
if (value == null)
return pickFromList(_random, Colors.primaries)[(_random.nextInt(9) + 1) * 100];
return pickFromList<MaterialColor>(_random, Colors.primaries)[(_random.nextInt(9) + 1) * 100];
switch (_random.nextInt(4)) {
case 0:
return value.withAlpha(value.alpha + _random.nextInt(10) - 5);
@@ -240,7 +240,7 @@ class _FuzzerState extends State<Fuzzer> with SingleTickerProviderStateMixin {
case 0:
return null;
case 1:
return pickFromList(_random, TextDecorationStyle.values);
return pickFromList<TextDecorationStyle>(_random, TextDecorationStyle.values);
}
return value;
}
@@ -250,7 +250,7 @@ class _FuzzerState extends State<Fuzzer> with SingleTickerProviderStateMixin {
case 0:
return null;
case 1:
return pickFromList(_random, FontWeight.values);
return pickFromList<FontWeight>(_random, FontWeight.values);
}
return value;
}
@@ -260,7 +260,7 @@ class _FuzzerState extends State<Fuzzer> with SingleTickerProviderStateMixin {
case 0:
return null;
case 1:
return pickFromList(_random, FontStyle.values);
return pickFromList<FontStyle>(_random, FontStyle.values);
}
return value;
}
@@ -938,7 +938,7 @@ class _PaintingState extends State<Painting> with SingleTickerProviderStateMixin
if (mounted && intrinsicKey.currentContext.size.height != controlKey.currentContext.size.height) {
debugPrint('Found some text that unexpectedly renders at different heights.');
debugPrint('Text: $_text');
debugPrint(_text.runes.map((int index) => 'U+' + index.toRadixString(16).padLeft(4, '0')).join(' '));
debugPrint(_text.runes.map<String>((int index) => 'U+' + index.toRadixString(16).padLeft(4, '0')).join(' '));
setState(() {
_ticker.stop();
});
@@ -1045,7 +1045,7 @@ class _PaintingState extends State<Painting> with SingleTickerProviderStateMixin
FlatButton(
onPressed: _ticker.isActive ? null : () {
print('The currently visible text is: $_text');
print(_text.runes.map((int value) => 'U+${value.toRadixString(16).padLeft(4, '0').toUpperCase()}').join(' '));
print(_text.runes.map<String>((int value) => 'U+${value.toRadixString(16).padLeft(4, '0').toUpperCase()}').join(' '));
},
child: const Text('DUMP TEXT TO LOGS'),
),
@@ -2109,7 +2109,7 @@ int randomCharacter(math.Random random) {
Range(0x2ceb0, 0x2ebe0),
Range(0x2f800, 0x2fa1d),
];
final Range range = pickFromList(random, characterRanges);
final Range range = pickFromList<Range>(random, characterRanges);
if (range.start == range.end)
return range.start;
return range.start + random.nextInt(range.end - range.start);

View File

@@ -12,7 +12,7 @@ import 'mock_image_http.dart';
void main() {
testWidgets('Card Collection smoke test', (WidgetTester tester) async {
HttpOverrides.runZoned(() async {
HttpOverrides.runZoned<Future<void>>(() async {
card_collection.main(); // builds the app and schedules a frame but doesn't trigger one
await tester.pump(); // see https://github.com/flutter/flutter/issues/1865
await tester.pump(); // triggers a frame

View File

@@ -12,7 +12,7 @@ import 'mock_image_http.dart';
void main() {
testWidgets('Color testing demo smoke test', (WidgetTester tester) async {
HttpOverrides.runZoned(() async {
HttpOverrides.runZoned<Future<void>>(() async {
color_testing_demo.main(); // builds the app and schedules a frame but doesn't trigger one
await tester.pump(); // see https://github.com/flutter/flutter/issues/1865
await tester.pump(); // triggers a frame

View File

@@ -146,7 +146,7 @@ Future<Null> main(List<String> arguments) async {
}
String quote(String arg) => arg.contains(' ') ? "'$arg'" : arg;
print('Executing: (cd dev/docs ; $pubExecutable ${dartdocArgs.map(quote).join(' ')})');
print('Executing: (cd dev/docs ; $pubExecutable ${dartdocArgs.map<String>(quote).join(' ')})');
process = await Process.start(
pubExecutable,
@@ -302,7 +302,7 @@ void putRedirectInOldIndexLocation() {
}
List<String> findPackageNames() {
return findPackages().map((FileSystemEntity file) => path.basename(file.path)).toList();
return findPackages().map<String>((FileSystemEntity file) => path.basename(file.path)).toList();
}
/// Finds all packages in the Flutter SDK
@@ -350,8 +350,8 @@ void printStream(Stream<List<int>> stream, { String prefix = '', List<Pattern> f
assert(prefix != null);
assert(filter != null);
stream
.transform(utf8.decoder)
.transform(const LineSplitter())
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
if (!filter.any((Pattern pattern) => line.contains(pattern)))
print('$prefix$line'.trim());

View File

@@ -135,7 +135,7 @@ String _jsonToMap(dynamic json) {
}
if (json is Iterable)
return '<dynamic>[${json.map(_jsonToMap).join(',')}]';
return '<dynamic>[${json.map<String>(_jsonToMap).join(',')}]';
if (json is Map<String, dynamic>) {
final StringBuffer buffer = StringBuffer('<String, dynamic>{');

View File

@@ -202,7 +202,7 @@ String generateTranslationBundles() {
///
/// * [getTranslation], whose documentation describes these values.
final Set<String> kSupportedLanguages = HashSet<String>.from(const <String>[
${languageCodes.map((String value) => " '$value', // ${describeLocale(value)}").toList().join('\n')}
${languageCodes.map<String>((String value) => " '$value', // ${describeLocale(value)}").toList().join('\n')}
]);
/// Creates a [GlobalMaterialLocalizations] instance for the given `locale`.

View File

@@ -105,7 +105,7 @@ void main(List<String> args) {
exit(1);
}
final List<int> parts = match.groups(<int>[1, 2, 3]).map(int.parse).toList();
final List<int> parts = match.groups(<int>[1, 2, 3]).map<int>(int.parse).toList();
if (match.group(4) == '0') {
print('This commit has already been released, as version ${parts.join(".")}.');

View File

@@ -29,7 +29,7 @@ void checkCwdIsRepoRoot(String commandName) {
String camelCase(String locale) {
return locale
.split('_')
.map((String part) => part.substring(0, 1).toUpperCase() + part.substring(1).toLowerCase())
.map<String>((String part) => part.substring(0, 1).toUpperCase() + part.substring(1).toLowerCase())
.join('');
}
@@ -91,7 +91,7 @@ Future<void> precacheLanguageAndRegionTags() async {
final HttpClient client = HttpClient();
final HttpClientRequest request = await client.getUrl(Uri.parse(registry));
final HttpClientResponse response = await request.close();
final String body = (await response.transform(utf8.decoder).toList()).join('');
final String body = (await response.transform<String>(utf8.decoder).toList()).join('');
client.close(force: true);
final List<Map<String, List<String>>> sections = body.split('%%').skip(1).map<Map<String, List<String>>>(_parseSection).toList();
for (Map<String, List<String>> section in sections) {

View File

@@ -199,9 +199,9 @@ String regenerateIconsFile(String iconData, String codepointData) {
String generateIconDeclarations(String codepointData) {
return LineSplitter.split(codepointData)
.map((String l) => l.trim())
.map<String>((String l) => l.trim())
.where((String l) => l.isNotEmpty)
.map(getIconDeclaration)
.map<String>(getIconDeclaration)
.join();
}

View File

@@ -314,7 +314,7 @@ class SvgPath {
SvgPath applyTransform(_Transform transform) {
final List<SvgPathCommand> transformedCommands =
commands.map((SvgPathCommand c) => c.applyTransform(transform)).toList();
commands.map<SvgPathCommand>((SvgPathCommand c) => c.applyTransform(transform)).toList();
return SvgPath(id, transformedCommands, opacity: opacity * transform.opacity);
}
@@ -400,7 +400,7 @@ class SvgPathCommandBuilder {
SvgPathCommand build(String type, List<Point<double>> points) {
List<Point<double>> absPoints = points;
if (_isRelativeCommand(type)) {
absPoints = points.map((Point<double> p) => p + lastPoint).toList();
absPoints = points.map<Point<double>>((Point<double> p) => p + lastPoint).toList();
}
if (type == 'M' || type == 'm')