Unverified Commit f62afdcf authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

add missing type parameter on methods (#22096)

parent 48fb726b
......@@ -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(
......
......@@ -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),
......
......@@ -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(
......
......@@ -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'
......
......@@ -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);
......
......@@ -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');
});
......
......@@ -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
......
......@@ -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 ]);
......
......@@ -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;
}
......
......@@ -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();
}
......
......@@ -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');
});
......
......@@ -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]);
......
......@@ -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.';
......
......@@ -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.';
......
......@@ -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)
......
......@@ -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);
}
}
......
......@@ -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: () {
......
......@@ -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');
......
......@@ -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(),
);
}
}
......
......@@ -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()
)
)
);
......
......@@ -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,
);
......
......@@ -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);
......
......@@ -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
......
......@@ -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
......
......@@ -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());
......
......@@ -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>{');
......
......@@ -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`.
......
......@@ -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(".")}.');
......
......@@ -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) {
......
......@@ -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();
}
......
......@@ -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')
......
......@@ -89,7 +89,7 @@ class SampleInfo {
final String classNames = commentValues['classes'];
if (classNames == null)
return const <String>[];
return classNames.split(',').map((String s) => s.trim()).where((String s) => s.isNotEmpty);
return classNames.split(',').map<String>((String s) => s.trim()).where((String s) => s.isNotEmpty);
}
// The relative import path for this sample, like '../lib/foo.dart'.
......@@ -163,7 +163,7 @@ void generate(String commit) {
final String entryTemplate = inputFile('bin', 'entry.md.template').readAsStringSync();
// Write the sample catalog's home page: index.md
final Iterable<String> entries = samples.map((SampleInfo sample) {
final Iterable<String> entries = samples.map<String>((SampleInfo sample) {
return expandTemplate(entryTemplate, sample.commentValues);
});
writeExpandedTemplate(
......@@ -195,7 +195,7 @@ void generate(String commit) {
}
}
for (String className in classToSamples.keys) {
final Iterable<String> entries = classToSamples[className].map((SampleInfo sample) {
final Iterable<String> entries = classToSamples[className].map<String>((SampleInfo sample) {
return expandTemplate(entryTemplate, sample.commentValues);
});
writeExpandedTemplate(
......@@ -215,10 +215,10 @@ void generate(String commit) {
outputFile('screenshot.dart', driverDirectory),
inputFile('bin', 'screenshot.dart.template').readAsStringSync(),
<String, String>{
'imports': samples.map((SampleInfo page) {
'imports': samples.map<String>((SampleInfo page) {
return "import '${page.importPath}' show ${page.sampleClass};\n";
}).toList().join(),
'widgets': samples.map((SampleInfo sample) {
'widgets': samples.map<String>((SampleInfo sample) {
return 'new ${sample.sampleClass}(),\n';
}).toList().join(),
},
......@@ -230,7 +230,7 @@ void generate(String commit) {
outputFile('screenshot_test.dart', driverDirectory),
inputFile('bin', 'screenshot_test.dart.template').readAsStringSync(),
<String, String>{
'paths': samples.map((SampleInfo sample) {
'paths': samples.map<String>((SampleInfo sample) {
return "'${outputFile(sample.sourceName + '.png').path}'";
}).toList().join(',\n'),
},
......
......@@ -63,7 +63,7 @@ class _AppBarBottomSampleState extends State<AppBarBottomSample> with SingleTick
),
body: TabBarView(
controller: _tabController,
children: choices.map((Choice choice) {
children: choices.map<Widget>((Choice choice) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: ChoiceCard(choice: choice),
......
......@@ -37,7 +37,7 @@ class _BasicAppBarSampleState extends State<BasicAppBarSample> {
PopupMenuButton<Choice>( // overflow menu
onSelected: _select,
itemBuilder: (BuildContext context) {
return choices.skip(2).map((Choice choice) {
return choices.skip(2).map<PopupMenuItem<Choice>>((Choice choice) {
return PopupMenuItem<Choice>(
value: choice,
child: Text(choice.title),
......
......@@ -50,7 +50,7 @@ class AdjustableDropdownListTile extends StatelessWidget {
trailing: DropdownButton<String>(
value: value,
onChanged: onChanged,
items: items.map((String item) {
items: items.map<DropdownMenuItem<String>>((String item) {
return DropdownMenuItem<String>(
value: item,
child: Text(item),
......
......@@ -78,7 +78,7 @@ class EntryItem extends StatelessWidget {
return ExpansionTile(
key: PageStorageKey<Entry>(root),
title: Text(root.title),
children: root.children.map(_buildTiles).toList(),
children: root.children.map<Widget>(_buildTiles).toList(),
);
}
......
......@@ -15,7 +15,7 @@ class TabbedAppBarSample extends StatelessWidget {
title: const Text('Tabbed AppBar'),
bottom: TabBar(
isScrollable: true,
tabs: choices.map((Choice choice) {
tabs: choices.map<Widget>((Choice choice) {
return Tab(
text: choice.title,
icon: Icon(choice.icon),
......@@ -24,7 +24,7 @@ class TabbedAppBarSample extends StatelessWidget {
),
),
body: TabBarView(
children: choices.map((Choice choice) {
children: choices.map<Widget>((Choice choice) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: ChoiceCard(choice: choice),
......
......@@ -493,7 +493,7 @@ class _AnimationDemoHomeState extends State<AnimationDemoHome> {
}
Iterable<Widget> _detailItemsFor(Section section) {
final Iterable<Widget> detailItems = section.details.map((SectionDetail detail) {
final Iterable<Widget> detailItems = section.details.map<Widget>((SectionDetail detail) {
return SectionDetailView(detail: detail);
});
return ListTile.divideTiles(context: context, tiles: detailItems);
......@@ -591,7 +591,7 @@ class _AnimationDemoHomeState extends State<AnimationDemoHome> {
},
child: PageView(
controller: _detailsPageController,
children: allSections.map((Section section) {
children: allSections.map<Widget>((Section section) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: _detailItemsFor(section).toList(),
......
......@@ -99,7 +99,7 @@ class PaletteTabView extends StatelessWidget {
final TextTheme textTheme = Theme.of(context).textTheme;
final TextStyle whiteTextStyle = textTheme.body1.copyWith(color: Colors.white);
final TextStyle blackTextStyle = textTheme.body1.copyWith(color: Colors.black);
final List<Widget> colorItems = primaryKeys.map((int index) {
final List<Widget> colorItems = primaryKeys.map<Widget>((int index) {
return DefaultTextStyle(
style: index > colors.threshold ? whiteTextStyle : blackTextStyle,
child: ColorItem(index: index, color: colors.primary[index]),
......@@ -107,7 +107,7 @@ class PaletteTabView extends StatelessWidget {
}).toList();
if (colors.accent != null) {
colorItems.addAll(accentKeys.map((int index) {
colorItems.addAll(accentKeys.map<Widget>((int index) {
return DefaultTextStyle(
style: index > colors.threshold ? whiteTextStyle : blackTextStyle,
child: ColorItem(index: index, color: colors.accent[index], prefix: 'A'),
......@@ -135,11 +135,11 @@ class ColorsDemo extends StatelessWidget {
title: const Text('Colors'),
bottom: TabBar(
isScrollable: true,
tabs: allPalettes.map((Palette swatch) => Tab(text: swatch.name)).toList(),
tabs: allPalettes.map<Widget>((Palette swatch) => Tab(text: swatch.name)).toList(),
),
),
body: TabBarView(
children: allPalettes.map((Palette colors) {
children: allPalettes.map<Widget>((Palette colors) {
return PaletteTabView(colors: colors);
}).toList(),
),
......
......@@ -54,7 +54,7 @@ class _ContactItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
final ThemeData themeData = Theme.of(context);
final List<Widget> columnChildren = lines.sublist(0, lines.length - 1).map((String line) => Text(line)).toList();
final List<Widget> columnChildren = lines.sublist(0, lines.length - 1).map<Widget>((String line) => Text(line)).toList();
columnChildren.add(Text(lines.last, style: themeData.textTheme.caption));
final List<Widget> rowChildren = <Widget>[
......
......@@ -58,7 +58,7 @@ class _CupertinoRefreshControlDemoState extends State<CupertinoRefreshControlDem
CupertinoSliverRefreshControl(
onRefresh: () {
return Future<void>.delayed(const Duration(seconds: 2))
..then((_) {
..then<void>((_) {
if (mounted) {
setState(() => repopulateList());
}
......
......@@ -281,7 +281,7 @@ class _ColorsItem extends StatelessWidget {
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: colors.map((_NamedColor namedColor) {
children: colors.map<Widget>((_NamedColor namedColor) {
return RawMaterialButton(
onPressed: () {
onChanged(namedColor.color);
......
......@@ -194,7 +194,7 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo>
Widget build(BuildContext context) {
final BottomNavigationBar botNavBar = BottomNavigationBar(
items: _navigationViews
.map((NavigationIconView navigationView) => navigationView.item)
.map<BottomNavigationBarItem>((NavigationIconView navigationView) => navigationView.item)
.toList(),
currentIndex: _currentIndex,
type: _type,
......
......@@ -280,7 +280,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
dropdown1Value = newValue;
});
},
items: <String>['One', 'Two', 'Free', 'Four'].map((String value) {
items: <String>['One', 'Two', 'Free', 'Four'].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
......@@ -301,7 +301,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
dropdown2Value = newValue;
});
},
items: <String>['One', 'Two', 'Free', 'Four'].map((String value) {
items: <String>['One', 'Two', 'Free', 'Four'].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
......@@ -325,7 +325,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
'One', 'Two', 'Free', 'Four', 'Can', 'I', 'Have', 'A', 'Little',
'Bit', 'More', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten'
]
.map((String value) {
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
......@@ -365,7 +365,7 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
onPressed: null,
)
]
.map((Widget button) => SizedBox(width: 64.0, height: 64.0, child: button))
.map<Widget>((Widget button) => SizedBox(width: 64.0, height: 64.0, child: button))
.toList(),
),
);
......
......@@ -191,7 +191,7 @@ class _CardsDemoState extends State<CardsDemo> {
body: ListView(
itemExtent: TravelDestinationItem.height,
padding: const EdgeInsets.only(top: 8.0, left: 8.0, right: 8.0),
children: destinations.map((TravelDestination destination) {
children: destinations.map<Widget>((TravelDestination destination) {
return Container(
margin: const EdgeInsets.only(bottom: 8.0),
child: TravelDestinationItem(
......
......@@ -92,7 +92,7 @@ class _ChipsTile extends StatelessWidget {
];
if (children.isNotEmpty) {
cardChildren.add(Wrap(
children: children.map((Widget chip) {
children: children.map<Widget>((Widget chip) {
return Padding(
padding: const EdgeInsets.all(2.0),
child: chip,
......
......@@ -201,7 +201,7 @@ class _DateAndTimePickerDemoState extends State<DateAndTimePickerDemo> {
_activity = newValue;
});
},
items: _allActivities.map((String value) {
items: _allActivities.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
......
......@@ -201,7 +201,7 @@ class DialogDemoState extends State<DialogDemo> {
),
]
// Add a little space between the buttons
.map((Widget button) {
.map<Widget>((Widget button) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: button
......
......@@ -159,7 +159,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: _drawerContents.map((String id) {
children: _drawerContents.map<Widget>((String id) {
return ListTile(
leading: CircleAvatar(child: Text(id)),
title: Text('Drawer item $id'),
......
......@@ -25,7 +25,7 @@ class _ElevationDemoState extends State<ElevationDemo> {
24.0,
];
return elevations.map((double elevation) {
return elevations.map<Widget>((double elevation) {
return Center(
child: Card(
margin: const EdgeInsets.all(20.0),
......
......@@ -356,7 +356,7 @@ class _ExpansionPanelsDemoState extends State<ExpansionPanelsDemo> {
_demoItems[index].isExpanded = !isExpanded;
});
},
children: _demoItems.map((DemoItem<dynamic> item) {
children: _demoItems.map<ExpansionPanel>((DemoItem<dynamic> item) {
return ExpansionPanel(
isExpanded: item.isExpanded,
headerBuilder: item.headerBuilder,
......
......@@ -251,7 +251,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
)
)
]
.map((Widget child) {
.map<Widget>((Widget child) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 8.0),
height: 96.0,
......
......@@ -374,7 +374,7 @@ class GridListDemoState extends State<GridListDemo> {
crossAxisSpacing: 4.0,
padding: const EdgeInsets.all(4.0),
childAspectRatio: (orientation == Orientation.portrait) ? 1.0 : 1.3,
children: photos.map((Photo photo) {
children: photos.map<Widget>((Photo photo) {
return GridDemoPhotoItem(
photo: photo,
tileStyle: _tileStyle,
......
......@@ -126,7 +126,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
);
} else {
body = ListView(
children: leaveBehindItems.map((LeaveBehindItem item) {
children: leaveBehindItems.map<Widget>((LeaveBehindItem item) {
return _LeaveBehindListItem(
item: item,
onArchive: _handleArchive,
......
......@@ -209,7 +209,7 @@ class _ListDemoState extends State<ListDemo> {
break;
}
Iterable<Widget> listTiles = items.map((String item) => buildListTile(context, item));
Iterable<Widget> listTiles = items.map<Widget>((String item) => buildListTile(context, item));
if (_showDividers)
listTiles = ListTile.divideTiles(context: context, tiles: listTiles);
......
......@@ -29,7 +29,7 @@ class OverscrollDemoState extends State<OverscrollDemo> {
Future<Null> _handleRefresh() {
final Completer<Null> completer = Completer<Null>();
Timer(const Duration(seconds: 3), () { completer.complete(null); });
return completer.future.then((_) {
return completer.future.then<Null>((_) {
_scaffoldKey.currentState?.showSnackBar(SnackBar(
content: const Text('Refresh complete'),
action: SnackBarAction(
......
......@@ -54,7 +54,7 @@ class _PageSelector extends StatelessWidget {
color: color,
),
child: TabBarView(
children: icons.map((Icon icon) {
children: icons.map<Widget>((Icon icon) {
return Container(
padding: const EdgeInsets.all(12.0),
child: Card(
......
......@@ -94,7 +94,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing
];
return Column(
children: indicators
.map((Widget c) => Container(child: c, margin: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0)))
.map<Widget>((Widget c) => Container(child: c, margin: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0)))
.toList(),
);
}
......
......@@ -44,7 +44,7 @@ class _ListDemoState extends State<ReorderableListDemo> {
bool _reverseSort = false;
final List<_ListItem> _items = <String>[
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
].map((String item) => _ListItem(item, false)).toList();
].map<_ListItem>((String item) => _ListItem(item, false)).toList();
void changeItemType(_ReorderableListType type) {
setState(() {
......@@ -191,7 +191,7 @@ class _ListDemoState extends State<ReorderableListDemo> {
onReorder: _onReorder,
scrollDirection: _itemType == _ReorderableListType.horizontalAvatar ? Axis.horizontal : Axis.vertical,
padding: const EdgeInsets.symmetric(vertical: 8.0),
children: _items.map(buildListTile).toList(),
children: _items.map<Widget>(buildListTile).toList(),
),
),
);
......
......@@ -174,7 +174,7 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
),
body: TabBarView(
controller: _controller,
children: _allPages.map((_Page page) {
children: _allPages.map<Widget>((_Page page) {
return SafeArea(
top: false,
bottom: false,
......
......@@ -160,7 +160,7 @@ class _SearchDemoSearchDelegate extends SearchDelegate<int> {
return _SuggestionList(
query: query,
suggestions: suggestions.map((int i) => '$i').toList(),
suggestions: suggestions.map<String>((int i) => '$i').toList(),
onSelected: (String suggestion) {
query = suggestion;
showResults(context);
......
......@@ -60,7 +60,7 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
),
const Text(_text3),
]
.map((Widget child) {
.map<Widget>((Widget child) {
return Container(
margin: const EdgeInsets.symmetric(vertical: 12.0),
child: child
......
......@@ -157,7 +157,7 @@ class TabsDemo extends StatelessWidget {
expandedHeight: 150.0,
forceElevated: innerBoxIsScrolled,
bottom: TabBar(
tabs: _allPages.keys.map(
tabs: _allPages.keys.map<Widget>(
(_Page page) => Tab(text: page.label),
).toList(),
),
......@@ -166,7 +166,7 @@ class TabsDemo extends StatelessWidget {
];
},
body: TabBarView(
children: _allPages.keys.map((_Page page) {
children: _allPages.keys.map<Widget>((_Page page) {
return SafeArea(
top: false,
bottom: false,
......
......@@ -136,7 +136,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat
title: const Text('FAB per tab'),
bottom: TabBar(
controller: _controller,
tabs: _allPages.map((_Page page) => Tab(text: page.label.toUpperCase())).toList(),
tabs: _allPages.map<Widget>((_Page page) => Tab(text: page.label.toUpperCase())).toList(),
),
actions: <Widget>[
MaterialDemoDocumentationButton(TabsFabDemo.routeName),
......@@ -153,7 +153,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> with SingleTickerProviderStat
floatingActionButton: buildFloatingActionButton(_selectedPage),
body: TabBarView(
controller: _controller,
children: _allPages.map(buildTabView).toList()
children: _allPages.map<Widget>(buildTabView).toList()
),
);
}
......
......@@ -59,7 +59,7 @@ class TooltipDemo extends StatelessWidget {
)
)
]
.map((Widget widget) {
.map<Widget>((Widget widget) {
return Padding(
padding: const EdgeInsets.only(top: 16.0, left: 16.0, right: 16.0),
child: widget
......
......@@ -492,7 +492,7 @@ class RecipeSheet extends StatelessWidget {
),
]
),
]..addAll(recipe.ingredients.map(
]..addAll(recipe.ingredients.map<TableRow>(
(RecipeIngredient ingredient) {
return _buildItemRow(ingredient.amount, ingredient.description);
}
......@@ -506,7 +506,7 @@ class RecipeSheet extends StatelessWidget {
),
]
)
)..addAll(recipe.steps.map(
)..addAll(recipe.steps.map<TableRow>(
(RecipeStep step) {
return _buildItemRow(step.duration ?? '', step.description);
}
......
......@@ -395,7 +395,7 @@ class _ShrineHomeState extends State<ShrineHome> {
sliver: SliverGrid(
gridDelegate: gridDelegate,
delegate: SliverChildListDelegate(
_products.map((Product product) {
_products.map<Widget>((Product product) {
return _ProductItem(
product: product,
onPressed: () { _showOrderPage(product); },
......
......@@ -46,7 +46,7 @@ class _ProductItem extends StatelessWidget {
),
),
child: DropdownButton<int>(
items: <int>[0, 1, 2, 3, 4, 5].map((int value) {
items: <int>[0, 1, 2, 3, 4, 5].map<DropdownMenuItem<int>>((int value) {
return DropdownMenuItem<int>(
value: value,
child: Padding(
......
......@@ -381,7 +381,7 @@ class _VideoDemoState extends State<VideoDemo>
initController(butterflyController);
initController(beeController);
isIOSSimulator().then((bool result) {
isIOSSimulator().then<void>((bool result) {
isSupported = !result;
});
}
......
......@@ -96,11 +96,11 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
),
bottom: TabBar(
isScrollable: true,
tabs: demos.map((ComponentDemoTabData data) => Tab(text: data.tabName)).toList(),
tabs: demos.map<Widget>((ComponentDemoTabData data) => Tab(text: data.tabName)).toList(),
),
),
body: TabBarView(
children: demos.map((ComponentDemoTabData demo) {
children: demos.map<Widget>((ComponentDemoTabData demo) {
return SafeArea(
top: false,
bottom: false,
......
......@@ -104,7 +104,7 @@ DropdownButton<String>(
});
},
items: <String>['One', 'Two', 'Free', 'Four']
.map((String value) {
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value));
......@@ -263,7 +263,7 @@ GridView.count(
'https://example.com/image-2.jpg',
'...',
'https://example.com/image-n.jpg'
].map((String url) {
].map<Widget>((String url) {
return GridTile(
footer: GridTileBar(
title: Text(url)
......
......@@ -252,7 +252,7 @@ class _TextScaleFactorItem extends StatelessWidget {
padding: const EdgeInsetsDirectional.only(end: 16.0),
icon: const Icon(Icons.arrow_drop_down),
itemBuilder: (BuildContext context) {
return kAllGalleryTextScaleValues.map((GalleryTextScaleValue scaleValue) {
return kAllGalleryTextScaleValues.map<PopupMenuItem<GalleryTextScaleValue>>((GalleryTextScaleValue scaleValue) {
return PopupMenuItem<GalleryTextScaleValue>(
value: scaleValue,
child: Text(scaleValue.label),
......
......@@ -141,7 +141,7 @@ class CalculationManager {
final CalculationMessage message = CalculationMessage(data, _receivePort.sendPort);
// Spawn an isolate to JSON-parse the file contents. The JSON parsing
// is synchronous, so if done in the main isolate, the UI would block.
Isolate.spawn(_calculate, message).then<Null>((Isolate isolate) {
Isolate.spawn<CalculationMessage>(_calculate, message).then<Null>((Isolate isolate) {
if (!isRunning) {
isolate.kill(priority: Isolate.immediate);
} else {
......
......@@ -74,12 +74,12 @@ class AdaptiveContainer extends StatelessWidget {
if (MediaQuery.of(context).size.width < _kGridViewBreakpoint) {
return ListView(
itemExtent: _kListItemExtent,
children: names.map((String name) => AdaptedListItem(name: name)).toList(),
children: names.map<Widget>((String name) => AdaptedListItem(name: name)).toList(),
);
} else {
return GridView.extent(
maxCrossAxisExtent: _kMaxTileWidth,
children: names.map((String name) => AdaptedGridItem(name: name)).toList(),
children: names.map<Widget>((String name) => AdaptedGridItem(name: name)).toList(),
);
}
}
......
......@@ -28,7 +28,7 @@ class SectorAppState extends State<SectorApp> {
List<double> wantedSectorSizes = <double>[];
List<double> actualSectorSizes = <double>[];
double get currentTheta => wantedSectorSizes.fold(0.0, (double total, double value) => total + value);
double get currentTheta => wantedSectorSizes.fold<double>(0.0, (double total, double value) => total + value);
void addSector() {
final double currentTheta = this.currentTheta;
......
......@@ -20,7 +20,7 @@ HAL: This mission is too important for me to allow you to jeopardize it.''';
// [["Dave", "Open the pod bay..."] ...]
final List<List<String>> _kNameLines = _kDialogText
.split('\n')
.map((String line) => line.split(':'))
.map<List<String>>((String line) => line.split(':'))
.toList();
final TextStyle _kDaveStyle = TextStyle(color: Colors.indigo.shade400, height: 1.8);
......
......@@ -19,7 +19,7 @@ class StockStrings {
static Future<StockStrings> load(Locale locale) {
return initializeMessages(locale.toString())
.then((Object _) {
.then<StockStrings>((Object _) {
return StockStrings(locale);
});
}
......
......@@ -191,7 +191,7 @@ class _CupertinoButtonState extends State<CupertinoButton> with SingleTickerProv
final Future<Null> ticker = _buttonHeldDown
? _animationController.animateTo(1.0, duration: kFadeOutDuration)
: _animationController.animateTo(0.0, duration: kFadeInDuration);
ticker.then((Null value) {
ticker.then<void>((Null value) {
if (mounted && wasHeldDown != _buttonHeldDown)
_animate();
});
......
......@@ -1564,7 +1564,7 @@ class _RenderCupertinoDialogActions extends RenderBox
)
: Rect.zero;
final List<Rect> pressedButtonRects = _pressedButtons.map((RenderBox pressedButton) {
final List<Rect> pressedButtonRects = _pressedButtons.map<Rect>((RenderBox pressedButton) {
final MultiChildLayoutParentData buttonParentData = pressedButton.parentData;
return Rect.fromLTWH(
......
......@@ -50,7 +50,7 @@ Future<R> compute<Q, R>(ComputeCallback<Q, R> callback, Q message, { String debu
Timeline.startSync('$debugLabel: start', flow: flow);
final ReceivePort resultPort = ReceivePort();
Timeline.finishSync();
final Isolate isolate = await Isolate.spawn(
final Isolate isolate = await Isolate.spawn<_IsolateConfiguration<Q, R>>(
_spawn,
_IsolateConfiguration<Q, R>(
callback,
......
......@@ -32,7 +32,7 @@ DebugPrintCallback debugPrint = debugPrintThrottled;
/// Used by tests.
void debugPrintSynchronously(String message, { int wrapWidth }) {
if (wrapWidth != null) {
print(message.split('\n').expand((String line) => debugWordWrap(line, wrapWidth)).join('\n'));
print(message.split('\n').expand<String>((String line) => debugWordWrap(line, wrapWidth)).join('\n'));
} else {
print(message);
}
......@@ -42,7 +42,7 @@ void debugPrintSynchronously(String message, { int wrapWidth }) {
/// messages on platforms that rate-limit their logging (for example, Android).
void debugPrintThrottled(String message, { int wrapWidth }) {
if (wrapWidth != null) {
_debugPrintBuffer.addAll(message.split('\n').expand((String line) => debugWordWrap(line, wrapWidth)));
_debugPrintBuffer.addAll(message.split('\n').expand<String>((String line) => debugWordWrap(line, wrapWidth)));
} else {
_debugPrintBuffer.addAll(message.split('\n'));
}
......
......@@ -195,7 +195,7 @@ class _PathFrames {
final List<double> opacities;
void paint(ui.Canvas canvas, Color color, _UiPathFactory uiPathFactory, double progress) {
final double opacity = _interpolate(opacities, progress, lerpDouble);
final double opacity = _interpolate<double>(opacities, progress, lerpDouble);
final ui.Paint paint = ui.Paint()
..style = PaintingStyle.fill
..color = color.withOpacity(color.opacity * opacity);
......@@ -227,7 +227,7 @@ class _PathMoveTo extends _PathCommand {
@override
void apply(Path path, double progress) {
final Offset offset = _interpolate(points, progress, Offset.lerp);
final Offset offset = _interpolate<Offset>(points, progress, Offset.lerp);
path.moveTo(offset.dx, offset.dy);
}
}
......@@ -241,9 +241,9 @@ class _PathCubicTo extends _PathCommand {
@override
void apply(Path path, double progress) {
final Offset controlPoint1 = _interpolate(controlPoints1, progress, Offset.lerp);
final Offset controlPoint2 = _interpolate(controlPoints2, progress, Offset.lerp);
final Offset targetPoint = _interpolate(targetPoints, progress, Offset.lerp);
final Offset controlPoint1 = _interpolate<Offset>(controlPoints1, progress, Offset.lerp);
final Offset controlPoint2 = _interpolate<Offset>(controlPoints2, progress, Offset.lerp);
final Offset targetPoint = _interpolate<Offset>(targetPoints, progress, Offset.lerp);
path.cubicTo(
controlPoint1.dx, controlPoint1.dy,
controlPoint2.dx, controlPoint2.dy,
......@@ -260,7 +260,7 @@ class _PathLineTo extends _PathCommand {
@override
void apply(Path path, double progress) {
final Offset point = _interpolate(points, progress, Offset.lerp);
final Offset point = _interpolate<Offset>(points, progress, Offset.lerp);
path.lineTo(point.dx, point.dy);
}
}
......
......@@ -582,7 +582,7 @@ class _Circle {
double weightSum(Iterable<Animation<double>> animations) {
// We're adding flex values instead of animation values to produce correct
// ratios.
return animations.map(state._evaluateFlex).fold(0.0, (double sum, double value) => sum + value);
return animations.map<double>(state._evaluateFlex).fold<double>(0.0, (double sum, double value) => sum + value);
}
final double allWeights = weightSum(state._animations);
......
......@@ -278,10 +278,10 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
void didUpdateWidget(MergeableMaterial oldWidget) {
super.didUpdateWidget(oldWidget);
final Set<LocalKey> oldKeys = oldWidget.children.map(
final Set<LocalKey> oldKeys = oldWidget.children.map<LocalKey>(
(MergeableMaterialItem child) => child.key
).toSet();
final Set<LocalKey> newKeys = widget.children.map(
final Set<LocalKey> newKeys = widget.children.map<LocalKey>(
(MergeableMaterialItem child) => child.key
).toSet();
final Set<LocalKey> newOnly = newKeys.difference(oldKeys);
......
......@@ -30,7 +30,7 @@ class _AccountPictures extends StatelessWidget {
top: 0.0,
end: 0.0,
child: Row(
children: (otherAccountsPictures ?? <Widget>[]).take(3).map((Widget picture) {
children: (otherAccountsPictures ?? <Widget>[]).take(3).map<Widget>((Widget picture) {
return Padding(
padding: const EdgeInsetsDirectional.only(start: 8.0),
child: Semantics(
......
......@@ -223,7 +223,7 @@ class AssetImage extends AssetBundleImageProvider {
final Iterable<String> keys = parsedJson.keys;
final Map<String, List<String>> parsedManifest =
Map<String, List<String>>.fromIterables(keys,
keys.map((String key) => List<String>.from(parsedJson[key])));
keys.map<List<String>>((String key) => List<String>.from(parsedJson[key])));
// TODO(ianh): convert that data structure to the right types.
return SynchronousFuture<Map<String, List<String>>>(parsedManifest);
}
......
......@@ -355,7 +355,7 @@ class TextSpan extends DiagnosticableTree {
List<DiagnosticsNode> debugDescribeChildren() {
if (children == null)
return const <DiagnosticsNode>[];
return children.map((TextSpan child) {
return children.map<DiagnosticsNode>((TextSpan child) {
if (child != null) {
return child.toDiagnosticsNode();
} else {
......
......@@ -214,7 +214,7 @@ abstract class MultiChildLayoutDelegate {
if (_debugChildrenNeedingLayout.length > 1) {
throw FlutterError(
'The $this custom multichild layout delegate forgot to lay out the following children:\n'
' ${_debugChildrenNeedingLayout.map(_debugDescribeChild).join("\n ")}\n'
' ${_debugChildrenNeedingLayout.map<String>(_debugDescribeChild).join("\n ")}\n'
'Each child must be laid out exactly once.'
);
} else {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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